mirror of
https://github.com/Stichting-MINIX-Research-Foundation/pkgsrc-ng.git
synced 2025-09-24 04:03:34 -04:00
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
check "gopkg.in/check.v1"
|
|
)
|
|
|
|
func (s *Suite) Test_Pkglint_Main_help(c *check.C) {
|
|
exitcode := new(Pkglint).Main("pkglint", "-h")
|
|
|
|
c.Check(exitcode, equals, 0)
|
|
c.Check(s.Output(), check.Matches, `^\Qusage: pkglint [options] dir...\E\n(?s).+`)
|
|
}
|
|
|
|
func (s *Suite) Test_Pkglint_Main_version(c *check.C) {
|
|
exitcode := new(Pkglint).Main("pkglint", "--version")
|
|
|
|
c.Check(exitcode, equals, 0)
|
|
c.Check(s.Output(), equals, confVersion+"\n")
|
|
}
|
|
|
|
func (s *Suite) Test_Pkglint_Main_no_args(c *check.C) {
|
|
exitcode := new(Pkglint).Main("pkglint")
|
|
|
|
c.Check(exitcode, equals, 1)
|
|
c.Check(s.Stderr(), equals, "FATAL: \".\" is not inside a pkgsrc tree.\n")
|
|
}
|
|
|
|
// go test -c -covermode count
|
|
// pkgsrcdir=...
|
|
// env PKGLINT_TESTCMDLINE="$pkgsrcdir -r" ./pkglint.test -test.coverprofile pkglint.cov -check.f TestRunPkglint
|
|
// go tool cover -html=pkglint.cov -o coverage.html
|
|
func (s *Suite) Test_Pkglint_coverage(c *check.C) {
|
|
cmdline := os.Getenv("PKGLINT_TESTCMDLINE")
|
|
if cmdline != "" {
|
|
G.logOut, G.logErr, G.debugOut = os.Stdout, os.Stderr, os.Stdout
|
|
new(Pkglint).Main(append([]string{"pkglint"}, splitOnSpace(cmdline)...)...)
|
|
}
|
|
}
|