Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cage ¶
type Cage struct { // TestCage is the wrapped cage. TestCage cage.Cage // RootPath should be a path to the root folder of the project where the helper function used // to replace the hijacked values can properly accomplish its work. RootPath string }
Cage wraps a test cage.Cage and replaces the command's path and args hijacked by Encage() with values appropriate for tests.
type File ¶
type File struct { // Name is the file name. Name string // Content is the file content. Content string }
File represents an OS file.
func (*File) SortChildren ¶
func (f *File) SortChildren() FileTreeNode
SortChildren only returns the file.
type FileTreeNode ¶
type FileTreeNode interface { // GetName returns the name of the node. GetName() string // IsFolder returns true if the node is a Folder. IsFolder() bool // Write writes the whole subtree rooted at the node prepending the path with the given relative // path. Write(relativePath string) error // Clone clones the subtree rooted at the node. Clone() FileTreeNode // SortChildren sorts the children of the node and returns the node. SortChildren() FileTreeNode // Remove removes the path obtained by prepending the node name with the given relative path. Remove(relativePath string) error }
FileTreeNode represents a node of the OS file tree.
func ReadFileTree ¶
func ReadFileTree(relativePath string, readFileContents bool) (FileTreeNode, error)
ReadFileTree reads a file tree rooted at the given relative path.
func SortFileTree ¶
func SortFileTree(subroot FileTreeNode) FileTreeNode
SortFileTree sorts a whole file subtree and returns it.
type Folder ¶
type Folder struct { // Name is the folder name. Name string // Children are the files and fod Children []FileTreeNode }
Folder represents an OS folder.
func (*Folder) Clone ¶
func (f *Folder) Clone() FileTreeNode
Clone clones the subtree rooted at the folder.
func (*Folder) SortChildren ¶
func (f *Folder) SortChildren() FileTreeNode
SortChildren sorts the children of the folder and returns the folder.
type HTTPServerFactory ¶
type HTTPServerFactory struct { }
HTTPServerFactory represents a factory of HTTP servers for testing.
func (*HTTPServerFactory) NewDummy ¶
NewDummy creates a new TCP net.Listener at a random port, a new http.ServerMux responding "PAYLOAD" at GET /dummy and a new http.Server with the new mux. This function also creates a go routine that calls server.Serve(listener).
func (*HTTPServerFactory) NewDummyUploader ¶
NewDummyUploader creates a new TCP net.Listener at a random port, a new http.ServerMux responding upload routes and a new http.Server with the new mux. This function also creates a go routine that calls server.Serve(listener).
func (*HTTPServerFactory) NewFileServer ¶
func (f *HTTPServerFactory) NewFileServer(rootRelativePath string) (net.Listener, *http.Server, error)
NewFileServer returns a server that serves files.
type ProblemBundleFactory ¶
type ProblemBundleFactory struct { }
ProblemBundleFactory creates problem bundles for tests.
func (*ProblemBundleFactory) Create ¶
func (*ProblemBundleFactory) Create(bundle FileTreeNode, relativePath string) error
CreateCpp11HelloWorldBundle creates a hello world problem bundle for tests.
type ProgramFactory ¶
type ProgramFactory struct { }
ProgramFactory creates program source codes for tests.
func (*ProgramFactory) Create ¶
func (*ProgramFactory) Create(program, relativePath string) error
CreateCpp11HelloWorld outputs a c++11 hello world program to the given relative path.