MCPcopy Create free account
hub / github.com/akamensky/argparse / TestInternalFunctionCheck

Function TestInternalFunctionCheck

argparse_test.go:68–87  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

66}
67
68func TestInternalFunctionCheck(t *testing.T) {
69 var resultS string
70 //test string
71 a := &arg{
72 result: &resultS,
73 sname: "f",
74 lname: "flag",
75 size: 0,
76 opts: nil,
77 unique: true,
78 }
79
80 srgString := "-f"
81 failureMessage := "Argument's size < 1 is not allowed"
82
83 if _, err := a.check(srgString); err == nil || err.Error() != failureMessage {
84 t.Errorf("Test %s failed with error: \"%v\". error: %q expected", t.Name(), err, failureMessage)
85 }
86 a.parsed = false
87}
88
89func TestFlagAddArgumentFail(t *testing.T) {
90 type testCase struct {

Callers

nothing calls this directly

Calls 2

checkMethod · 0.95
ErrorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…