conformance

package
v0.1.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package conformance is a test suite for testing CLI parsing into jsonnext data structures. It can be used to check conformance of a CLI parsing implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLIParser

type CLIParser interface {
	Parse(t *testing.T, args []string) (*jsonnext.Config, error)
}

CLIParser should be implemented by a jsonnext.Config CLI parsing implementation to test its conformance to the standard parsing expected. Parse() is called with a given command line for which the parse must return a *jsonnext.Config corresponding to that set of CLI flags or return an error where those flags fail to parse..

type Suite

type Suite struct {
	suite.Suite
	// contains filtered or unexported fields
}

Suite is a conformance test for command line parsers that parse into a jsonnext.Config struct. The test case for the parser under test must implement CLIParser to parse a given command line into a *jsonnext.Config struct.

func NewSuite

func NewSuite(s CLIParser) *Suite

NewSuite returns a new Suite to test the conformance of the given parser.

func (*Suite) Run

func (s *Suite) Run(t *testing.T)

Run runs the conformance test in this package against the CLIParser configured in the Suite.

func (*Suite) TestImportPath

func (s *Suite) TestImportPath()

TestImportPath tests that the ImportPath field is set by the --jpath and -J flags.

func (*Suite) TestMaxStack added in v0.1.16

func (s *Suite) TestMaxStack()

TestMaxStack tests that the MaxStack field is set by the --max-stack flag, and that the default is set when the flag is not present.

func (*Suite) TestMaxTrace added in v0.1.16

func (s *Suite) TestMaxTrace()

TestMaxTrace tests that the MaxTrace field is set by the --max-trace flag, and that the default is set when the flag is not present.

func (*Suite) TestVMVarErr

func (s *Suite) TestVMVarErr()

TestVMVarErr tests that all styles of VMVar flags generate errors when both a value is not provided with the corresponding environment variable unset, and when no variable name is provided.

func (*Suite) TestVMVarOverride

func (s *Suite) TestVMVarOverride()

TestVMVarOverride tests that when the same variable name is used for two VMVars of the same type (ext or TLA), that the last one has precedence and is present in the output configuration.

func (*Suite) TestVMVars

func (s *Suite) TestVMVars()

TestVMVars tests that all styles of VMVars are correctly parsed on the command line, either as literals on the command line or from the environment.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL