project

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package project collects information about test suite organisation by implementing various heuristics.

Index

Constants

View Source
const ManifestFile = "package.yml"

Variables

This section is empty.

Functions

func ContainsFile

func ContainsFile(p Interface, path string) bool

ContainsFile returns true, when path is managed by Interface.

func Discover

func Discover(path string) []string

Discover walks towards the file system root and collects known test suite layouts.

This initial version of Discover returns a string slice, but this may change in future releases.

func ExpandVar

func ExpandVar(s string, vars map[string]string) (string, error)

ExpandVar expands variables references inside a string using environment variables first and then a provided variables map second. If a reference could not expanded, the variable reference will stay inside the string and an an error will be returned.

func Files

func Files(p Interface) ([]string, error)

Files returns all .ttcn3 available. It will not return generated .ttcn3 files. On error Files will return an error.

func FindAllFiles

func FindAllFiles(p Interface) []string

FindAllFiles returns all .ttcn3 files including auxiliary files from k3 installation

func Fingerprint

func Fingerprint(p Interface) string

Fingerprint calculates a sum to identify a test suite based on its modules.

func GetVar

func GetVar(name string, vars map[string]string) (string, error)

GetVar returns a variable. Variable references in vars are expanded. Environment variables are not.

func Variables

func Variables(vars map[string]string) ([]string, error)

Variables return all declared variables, in the form "key=value".

Types

type Interface

type Interface interface {
	// Root is the test suite root folder. It is usually the folder where the manifest is.
	Root() string

	// Sources returns a slice of files and directories containing TTCN-3 source files.
	Sources() ([]string, error)

	// Imports returns a slice of additional directories required to build a test executable.
	// Codecs, adapters and libraries are specified by Imports, typically.
	Imports() ([]string, error)
}

Interface describes a TTCN-3 project.

type Manifest

type Manifest struct {
	// Static configuration
	Name      string
	Sources   []string
	Imports   []string
	Variables map[string]string

	// Runtime configuration
	TestHook       string  `yaml:"test_hook"`       // Path for test hook.
	ParametersFile string  `yaml:"parameters_file"` // Path for module parameters file.
	ParametersDir  string  `yaml:"parameters_dir"`  // Optional path for parameters_file.
	Timeout        float64 `yaml:"timeout"`         // Global timeout for tests.
}

type NoSuchVariableError

type NoSuchVariableError struct {
	Name string
}

func (*NoSuchVariableError) Error

func (e *NoSuchVariableError) Error() string

type Project

type Project struct {
	Manifest Manifest
	// contains filtered or unexported fields
}

A Project provides meta information about a TTCN-3 test suite. Meta information like: Location of configuration and source files, dependency list, default values, ...

func Open

func Open(path string) (*Project, error)

func (*Project) Environ

func (p *Project) Environ() ([]string, error)

Environ returns a copy of strings representing the environment, in the form "key=value".

func (*Project) Expand

func (p *Project) Expand(v string) (string, error)

Expand expands string v using Project.Getenv

func (*Project) FindModule

func (p *Project) FindModule(name string) (string, error)

FindModule tries to find a .ttcn3 based on its module name.

func (*Project) Getenv

func (p *Project) Getenv(v string) (string, error)

func (*Project) Imports

func (p *Project) Imports() ([]string, error)

func (*Project) Root

func (p *Project) Root() string

Root directory is ttcn3 suite.

func (*Project) Sources

func (p *Project) Sources() ([]string, error)

Sources returns all TTCN-3 source files.

func (*Project) String

func (p *Project) String() string

String returns a simple string representation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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