(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func TestSelect(t *testing.T) { |
| 16 | t.Parallel() |
| 17 | t.Run("Select", func(t *testing.T) { |
| 18 | t.Parallel() |
| 19 | ptty := ptytest.New(t) |
| 20 | msgChan := make(chan string) |
| 21 | go func() { |
| 22 | resp, err := newSelect(ptty, cliui.SelectOptions{ |
| 23 | Options: []string{"First", "Second"}, |
| 24 | }) |
| 25 | assert.NoError(t, err) |
| 26 | msgChan <- resp |
| 27 | }() |
| 28 | require.Equal(t, "First", <-msgChan) |
| 29 | }) |
| 30 | } |
| 31 | |
| 32 | func newSelect(ptty *ptytest.PTY, opts cliui.SelectOptions) (string, error) { |
| 33 | value := "" |