Skip to content

Commit

Permalink
Augment tests to cover new functions better
Browse files Browse the repository at this point in the history
  • Loading branch information
vsachs committed Aug 1, 2022
1 parent b53ab63 commit 30d4ae1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions argparse_test.go
Expand Up @@ -2797,9 +2797,9 @@ func TestCommandPositionalErr(t *testing.T) {
func TestCommandPositionals(t *testing.T) {
testArgs1 := []string{"posint", "5", "abc", "1.0"}
parser := NewParser("posint", "")
intval := parser.IntPositional(nil)
intval := parser.IntPositional(&Options{Required: false})
strval := parser.StringPositional(nil)
floatval := parser.FloatPositional(nil)
floatval := parser.FloatPositional(&Options{Default: 1.5})

if err := parser.Parse(testArgs1); err != nil {
t.Error(err.Error())
Expand Down Expand Up @@ -2929,6 +2929,19 @@ func TestPos6(t *testing.T) {
}
}

func TestPos7(t *testing.T) {
testArgs1 := []string{"pos", "beep"}
parser := NewParser("pos", "")

strval := parser.SelectorPositional([]string{"beep"}, &Options{Help: "wow"})

if err := parser.Parse(testArgs1); err != nil {
t.Error(err.Error())
} else if *strval != "beep" {
t.Error("Strval did not match expected")
}
}

func TestPosErr1(t *testing.T) {
errArgs1 := []string{"pos", "subcommand1"}
parser := NewParser("pos", "")
Expand Down

0 comments on commit 30d4ae1

Please sign in to comment.