MCPcopy
hub / github.com/urfave/cli / TestCommandReadArgsFromStdIn

Function TestCommandReadArgsFromStdIn

command_test.go:4825–4989  ·  command_test.go::TestCommandReadArgsFromStdIn
(t *testing.T)

Source from the content-addressed store, hash-verified

4823}
4824
4825func 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

Callers

nothing calls this directly

Calls 8

buildMinimalTestCommandFunction · 0.85
WriteMethod · 0.80
Int64Method · 0.80
FloatMethod · 0.80
StringSliceMethod · 0.80
NameMethod · 0.65
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected