(t *testing.T)
| 313 | } |
| 314 | |
| 315 | func TestRunTTY(t *testing.T) { |
| 316 | const sttyPartialOutput = "speed 38400 baud" |
| 317 | |
| 318 | testCase := nerdtest.Setup() |
| 319 | |
| 320 | testCase.SubTests = []*test.Case{ |
| 321 | { |
| 322 | Description: "stty with -it", |
| 323 | Cleanup: func(data test.Data, helpers test.Helpers) { |
| 324 | helpers.Ensure("rm", "-f", data.Identifier()) |
| 325 | }, |
| 326 | Command: func(data test.Data, helpers test.Helpers) test.TestableCommand { |
| 327 | cmd := helpers.Command("run", "-it", data.Identifier(), "stty") |
| 328 | cmd.WithPseudoTTY() |
| 329 | return cmd |
| 330 | }, |
| 331 | Expected: test.Expects(0, nil, expect.Contains(sttyPartialOutput)), |
| 332 | }, |
| 333 | { |
| 334 | Description: "stty with -t", |
| 335 | Cleanup: func(data test.Data, helpers test.Helpers) { |
| 336 | helpers.Ensure("rm", "-f", data.Identifier()) |
| 337 | }, |
| 338 | Command: func(data test.Data, helpers test.Helpers) test.TestableCommand { |
| 339 | cmd := helpers.Command("run", "-t", data.Identifier(), "stty") |
| 340 | cmd.WithPseudoTTY() |
| 341 | return cmd |
| 342 | }, |
| 343 | Expected: test.Expects(0, nil, expect.Contains(sttyPartialOutput)), |
| 344 | }, |
| 345 | { |
| 346 | Description: "stty with -i", |
| 347 | Cleanup: func(data test.Data, helpers test.Helpers) { |
| 348 | helpers.Ensure("rm", "-f", data.Identifier()) |
| 349 | }, |
| 350 | Command: func(data test.Data, helpers test.Helpers) test.TestableCommand { |
| 351 | cmd := helpers.Command("run", "-i", data.Identifier(), "stty") |
| 352 | cmd.WithPseudoTTY() |
| 353 | return cmd |
| 354 | }, |
| 355 | Expected: test.Expects(expect.ExitCodeGenericFail, nil, nil), |
| 356 | }, |
| 357 | { |
| 358 | Description: "stty without params", |
| 359 | Cleanup: func(data test.Data, helpers test.Helpers) { |
| 360 | helpers.Ensure("rm", "-f", data.Identifier()) |
| 361 | }, |
| 362 | Command: func(data test.Data, helpers test.Helpers) test.TestableCommand { |
| 363 | cmd := helpers.Command("run", data.Identifier(), "stty") |
| 364 | cmd.WithPseudoTTY() |
| 365 | return cmd |
| 366 | }, |
| 367 | Expected: test.Expects(expect.ExitCodeGenericFail, nil, nil), |
| 368 | }, |
| 369 | { |
| 370 | Description: "stty with -td", |
| 371 | Cleanup: func(data test.Data, helpers test.Helpers) { |
| 372 | helpers.Ensure("rm", "-f", data.Identifier()) |
nothing calls this directly
no test coverage detected
searching dependent graphs…