(t *testing.T)
| 4823 | } |
| 4824 | |
| 4825 | func TestCommandReadArgsFromStdIn(t *testing.T) { |
| 4826 | tests := []struct { |
| 4827 | name string |
| 4828 | input string |
| 4829 | args []string |
| 4830 | expectedInt int64 |
| 4831 | expectedFloat float64 |
| 4832 | expectedSlice []string |
| 4833 | expectError bool |
| 4834 | }{ |
| 4835 | { |
| 4836 | name: "empty", |
| 4837 | input: "", |
| 4838 | args: []string{"foo"}, |
| 4839 | expectedInt: 0, |
| 4840 | expectedFloat: 0.0, |
| 4841 | expectedSlice: []string{}, |
| 4842 | }, |
| 4843 | { |
| 4844 | name: "empty2", |
| 4845 | input: ` |
| 4846 | |
| 4847 | `, |
| 4848 | args: []string{"foo"}, |
| 4849 | expectedInt: 0, |
| 4850 | expectedFloat: 0.0, |
| 4851 | expectedSlice: []string{}, |
| 4852 | }, |
| 4853 | { |
| 4854 | name: "intflag-from-input", |
| 4855 | input: "--if=100", |
| 4856 | args: []string{"foo"}, |
| 4857 | expectedInt: 100, |
| 4858 | expectedFloat: 0.0, |
| 4859 | expectedSlice: []string{}, |
| 4860 | }, |
| 4861 | { |
| 4862 | name: "intflag-from-input2", |
| 4863 | input: ` |
| 4864 | --if |
| 4865 | |
| 4866 | 100`, |
| 4867 | args: []string{"foo"}, |
| 4868 | expectedInt: 100, |
| 4869 | expectedFloat: 0.0, |
| 4870 | expectedSlice: []string{}, |
| 4871 | }, |
| 4872 | { |
| 4873 | name: "multiflag-from-input", |
| 4874 | input: ` |
| 4875 | --if |
| 4876 | |
| 4877 | 100 |
| 4878 | --ff 100.1 |
| 4879 | |
| 4880 | --ssf hello |
| 4881 | --ssf |
| 4882 |
nothing calls this directly
no test coverage detected