Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unit tests #5

Open
justinbastress opened this issue Jun 27, 2018 · 1 comment
Open

Fix unit tests #5

justinbastress opened this issue Jun 27, 2018 · 1 comment

Comments

@justinbastress
Copy link
Contributor

On Windows, go test -v results in the following:

=== RUN   TestPositional
--- PASS: TestPositional (0.00s)
=== RUN   TestPositionalRequired
--- PASS: TestPositionalRequired (0.00s)
=== RUN   TestPositionalRequiredRest1Fail
--- PASS: TestPositionalRequiredRest1Fail (0.00s)
=== RUN   TestPositionalRequiredRest1Pass
--- PASS: TestPositionalRequiredRest1Pass (0.00s)
=== RUN   TestPositionalRequiredRest2Fail
--- PASS: TestPositionalRequiredRest2Fail (0.00s)
=== RUN   TestPositionalRequiredRest2Pass
--- PASS: TestPositionalRequiredRest2Pass (0.00s)
=== RUN   TestPositionalRequiredRestRangeFail
--- PASS: TestPositionalRequiredRestRangeFail (0.00s)
=== RUN   TestPositionalRequiredRestRangeEmptyFail
--- PASS: TestPositionalRequiredRestRangeEmptyFail (0.00s)
=== RUN   TestCommandInline
--- PASS: TestCommandInline (0.00s)
=== RUN   TestCommandInlineMulti
--- PASS: TestCommandInlineMulti (0.00s)
=== RUN   TestCommandFlagOrder1
--- PASS: TestCommandFlagOrder1 (0.00s)
=== RUN   TestCommandFlagOrder2
--- PASS: TestCommandFlagOrder2 (0.00s)
=== RUN   TestCommandFlagOrderSub
--- PASS: TestCommandFlagOrderSub (0.00s)
=== RUN   TestCommandFlagOverride1
--- PASS: TestCommandFlagOverride1 (0.00s)
=== RUN   TestCommandFlagOverride2
--- PASS: TestCommandFlagOverride2 (0.00s)
=== RUN   TestCommandFlagOverrideSub
--- PASS: TestCommandFlagOverrideSub (0.00s)
=== RUN   TestCommandFlagOverrideSub2
--- PASS: TestCommandFlagOverrideSub2 (0.00s)
=== RUN   TestCommandEstimate
--- PASS: TestCommandEstimate (0.00s)
=== RUN   TestCommandEstimate2
--- PASS: TestCommandEstimate2 (0.00s)
=== RUN   TestCommandValidate
--- PASS: TestCommandValidate (0.00s)
=== RUN   TestCommandClosest
--- PASS: TestCommandClosest (0.00s)
=== RUN   TestCommandAdd
--- PASS: TestCommandAdd (0.00s)
=== RUN   TestCommandNestedInline
--- PASS: TestCommandNestedInline (0.00s)
=== RUN   TestRequiredOnCommand
--- PASS: TestRequiredOnCommand (0.00s)
=== RUN   TestRequiredAllOnCommand
--- PASS: TestRequiredAllOnCommand (0.00s)
=== RUN   TestDefaultOnCommand
--- PASS: TestDefaultOnCommand (0.00s)
=== RUN   TestAfterNonCommand
--- PASS: TestAfterNonCommand (0.00s)
=== RUN   TestSubcommandsOptional
--- PASS: TestSubcommandsOptional (0.00s)
=== RUN   TestSubcommandsOptionalAfterNonCommand
--- PASS: TestSubcommandsOptionalAfterNonCommand (0.00s)
=== RUN   TestCommandAlias
--- PASS: TestCommandAlias (0.00s)
=== RUN   TestSubCommandFindOptionByLongFlag
--- PASS: TestSubCommandFindOptionByLongFlag (0.00s)
=== RUN   TestSubCommandFindOptionByShortFlag
--- PASS: TestSubCommandFindOptionByShortFlag (0.00s)
=== RUN   TestCompletion
--- FAIL: TestCompletion (0.00s)
	completion_test.go:262: Args: []string{"-"}, false
		  Expected: []string{"--debug", "--required", "--verbose", "--version", "-i"}
		  Got:     []string{"/debug", "/i", "/required", "/verbose", "/version"}
	completion_test.go:262: Args: []string{"--"}, false
		  Expected: []string{"--debug", "--required", "--verbose", "--version"}
		  Got:     []string{"/debug", "/required", "/verbose", "/version"}
	completion_test.go:262: Args: []string{"--ver"}, false
		  Expected: []string{"--verbose", "--version"}
		  Got:     []string{"/verbose", "/version"}
=== RUN   TestParserCompletion
--- FAIL: TestParserCompletion (0.00s)
	completion_test.go:310: Expected: []string{"--debug", "--required", "--verbose", "--version", "-i"}
		Got: []string{"/debug", "/i", "/required", "/verbose", "/version"}
	completion_test.go:310: Expected: []string{"--debug", "--required", "--verbose", "--version"}
		Got: []string{"/debug", "/required", "/verbose", "/version"}
	completion_test.go:310: Expected: []string{"--debug     # Enable debug", "--required  # This is required", "--verbose   # Verbose messages", "--version   # Show version"}
		Got: []string{"/debug     # Enable debug", "/required  # This is required", "/verbose   # Verbose messages", "/version   # Show version"}
	completion_test.go:310: Expected: []string{"--verbose", "--version"}
		Got: []string{"/verbose", "/version"}
=== RUN   TestConvertToString
--- PASS: TestConvertToString (0.00s)
=== RUN   TestConvertToStringInvalidIntBase
--- PASS: TestConvertToStringInvalidIntBase (0.00s)
=== RUN   TestConvertToStringInvalidUintBase
--- PASS: TestConvertToStringInvalidUintBase (0.00s)
=== RUN   TestGroupInline
--- PASS: TestGroupInline (0.00s)
=== RUN   TestGroupAdd
--- PASS: TestGroupAdd (0.00s)
=== RUN   TestGroupNestedInline
--- PASS: TestGroupNestedInline (0.00s)
=== RUN   TestGroupNestedInlineNamespace
--- PASS: TestGroupNestedInlineNamespace (0.00s)
=== RUN   TestDuplicateShortFlags
--- PASS: TestDuplicateShortFlags (0.00s)
=== RUN   TestDuplicateLongFlags
--- PASS: TestDuplicateLongFlags (0.00s)
=== RUN   TestFindOptionByLongFlag
--- PASS: TestFindOptionByLongFlag (0.00s)
=== RUN   TestFindOptionByShortFlag
--- PASS: TestFindOptionByShortFlag (0.00s)
=== RUN   TestFindOptionByLongFlagInSubGroup
--- PASS: TestFindOptionByLongFlagInSubGroup (0.00s)
=== RUN   TestFindOptionByShortFlagInSubGroup
--- PASS: TestFindOptionByShortFlagInSubGroup (0.00s)
=== RUN   TestHelp
--- PASS: TestHelp (0.00s)
=== RUN   TestMan
--- PASS: TestMan (0.00s)
=== RUN   TestHelpCommand
--- PASS: TestHelpCommand (0.00s)
=== RUN   TestHelpDefaults
--- PASS: TestHelpDefaults (0.00s)
=== RUN   TestHelpRestArgs
--- PASS: TestHelpRestArgs (0.00s)
=== RUN   TestWrapText
--- PASS: TestWrapText (0.00s)
=== RUN   TestWrapParagraph
--- PASS: TestWrapParagraph (0.00s)
=== RUN   TestHelpDefaultMask
--- PASS: TestHelpDefaultMask (0.00s)
=== RUN   TestWriteIni
--- PASS: TestWriteIni (0.00s)
=== RUN   TestReadIni_flagEquivalent
--- FAIL: TestReadIni_flagEquivalent (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x558ccc]

goroutine 108 [running]:
testing.tRunner.func1(0xc042232d20)
	C:/Go/src/testing/testing.go:711 +0x2d9
panic(0x5c2040, 0x6f3da0)
	C:/Go/src/runtime/panic.go:491 +0x291
github.com/zmap/zflags.(*IniParser).parse(0xc04202bec8, 0xc0422d5c40, 0x0, 0x0, 0xc0422d5c40, 0x0, 0x0, 0x5d8800, 0xc0422e3101, 0xc0422d5c20)
	C:/Users/localadmin/go/src/github.com/zmap/zflags/ini.go:603 +0xabc
github.com/zmap/zflags.(*IniParser).Parse(0xc04202bec8, 0x6e4920, 0xc0422d5c20, 0x5fed1f, 0x17, 0x5a3080, 0xc0422c4f28, 0xc0422e3290, 0x0, 0x0, ...)
	C:/Users/localadmin/go/src/github.com/zmap/zflags/ini.go:142 +0xd8
github.com/zmap/zflags.TestReadIni_flagEquivalent.func1(0x607a33, 0x9b, 0x6ab0b8, 0xf, 0x6e0f15)
	C:/Users/localadmin/go/src/github.com/zmap/zflags/ini_test.go:325 +0x21f
github.com/zmap/zflags.TestReadIni_flagEquivalent(0xc042232d20)
	C:/Users/localadmin/go/src/github.com/zmap/zflags/ini_test.go:337 +0x93
testing.tRunner(0xc042232d20, 0x60a8b0)
	C:/Go/src/testing/testing.go:746 +0xd7
created by testing.(*T).Run
	C:/Go/src/testing/testing.go:789 +0x2e5
exit status 2
FAIL	github.com/zmap/zflags	0.087s

The former is presumably Windows-specific, but the latter seems to be universal.

@zakird
Copy link
Member

zakird commented Jun 27, 2018

Note: we should also add travis to the repo as well to prevent this in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants