mirror of
https://gitlab.com/TECHNOFAB/nixtest.git
synced 2025-12-12 10:10:09 +01:00
refactor: split into packages and add tests
This commit is contained in:
parent
fd58344ca7
commit
11117e0c0e
28 changed files with 2736 additions and 636 deletions
64
internal/types/types.go
Normal file
64
internal/types/types.go
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
package types
|
||||
|
||||
import "time"
|
||||
|
||||
type TestType string
|
||||
|
||||
const (
|
||||
TestTypeScript TestType = "script"
|
||||
TestTypeUnit TestType = "unit"
|
||||
TestTypeSnapshot TestType = "snapshot"
|
||||
)
|
||||
|
||||
type SuiteSpec struct {
|
||||
Name string `json:"name"`
|
||||
Tests []TestSpec `json:"tests"`
|
||||
}
|
||||
|
||||
type TestSpec struct {
|
||||
Type TestType `json:"type"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Expected any `json:"expected,omitempty"`
|
||||
Actual any `json:"actual,omitempty"`
|
||||
ActualDrv string `json:"actualDrv,omitempty"`
|
||||
Script string `json:"script,omitempty"`
|
||||
Pos string `json:"pos,omitempty"`
|
||||
|
||||
Suite string
|
||||
}
|
||||
|
||||
type TestStatus int
|
||||
|
||||
const (
|
||||
StatusSuccess TestStatus = iota
|
||||
StatusFailure
|
||||
StatusError
|
||||
StatusSkipped
|
||||
)
|
||||
|
||||
func (ts TestStatus) String() string {
|
||||
switch ts {
|
||||
case StatusSuccess:
|
||||
return "SUCCESS"
|
||||
case StatusFailure:
|
||||
return "FAILURE"
|
||||
case StatusError:
|
||||
return "ERROR"
|
||||
case StatusSkipped:
|
||||
return "SKIPPED"
|
||||
default:
|
||||
return "UNKNOWN"
|
||||
}
|
||||
}
|
||||
|
||||
type TestResult struct {
|
||||
Spec TestSpec
|
||||
Status TestStatus
|
||||
Duration time.Duration
|
||||
ErrorMessage string
|
||||
Expected string
|
||||
Actual string
|
||||
}
|
||||
|
||||
type Results map[string][]TestResult
|
||||
Loading…
Add table
Add a link
Reference in a new issue