(t *testing.T)
| 838 | } |
| 839 | |
| 840 | func TestPromptInSummary(t *testing.T) { |
| 841 | t.Parallel() |
| 842 | |
| 843 | tests := []struct { |
| 844 | name string |
| 845 | input string |
| 846 | wantError bool |
| 847 | }{ |
| 848 | {"test short approval", "y\n", false}, |
| 849 | {"test long approval", "yes\n", false}, |
| 850 | {"test uppercase approval", "Y\n", false}, |
| 851 | {"test stops task", "n\n", true}, |
| 852 | {"test junk value stops task", "foobar\n", true}, |
| 853 | {"test Enter stops task", "\n", true}, |
| 854 | } |
| 855 | |
| 856 | for _, test := range tests { |
| 857 | t.Run(test.name, func(t *testing.T) { |
| 858 | t.Parallel() |
| 859 | |
| 860 | opts := []ExecutorTestOption{ |
| 861 | WithName(test.name), |
| 862 | WithExecutorOptions( |
| 863 | task.WithDir("testdata/prompt"), |
| 864 | task.WithAssumeTerm(true), |
| 865 | ), |
| 866 | WithTask("foo"), |
| 867 | WithInput(test.input), |
| 868 | } |
| 869 | if test.wantError { |
| 870 | opts = append(opts, WithRunError()) |
| 871 | } |
| 872 | NewExecutorTest(t, opts...) |
| 873 | }) |
| 874 | } |
| 875 | } |
| 876 | |
| 877 | func TestPromptWithIndirectTask(t *testing.T) { |
| 878 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…