refactor: modernize stdlib usage and move matchers into dsl
All checks were successful
build-dsl-smoke / Build judge (push) Successful in 16s
build-dsl-smoke / debug / clang / linux (push) Successful in 6s
build-dsl-smoke / debug / gcc / linux (push) Successful in 7s
build-dsl-smoke / release / clang / linux (push) Successful in 8s
build-dsl-smoke / release / gcc / linux (push) Successful in 9s
build-dsl-smoke / sanitized / gcc / linux (push) Successful in 6s
build-dsl-smoke / sanitized / clang / linux (push) Successful in 9s
build-dsl-smoke / debug-valgrind / gcc / linux (push) Successful in 15s
build-dsl-smoke / debug / clang / windows (push) Successful in 15s
build-dsl-smoke / debug / msvc / windows (push) Successful in 19s
build-dsl-smoke / release / clang / windows (push) Successful in 18s
build-dsl-smoke / release / msvc / windows (push) Successful in 18s
build-dsl-smoke / SUMMARY (push) Successful in 4s
All checks were successful
build-dsl-smoke / Build judge (push) Successful in 16s
build-dsl-smoke / debug / clang / linux (push) Successful in 6s
build-dsl-smoke / debug / gcc / linux (push) Successful in 7s
build-dsl-smoke / release / clang / linux (push) Successful in 8s
build-dsl-smoke / release / gcc / linux (push) Successful in 9s
build-dsl-smoke / sanitized / gcc / linux (push) Successful in 6s
build-dsl-smoke / sanitized / clang / linux (push) Successful in 9s
build-dsl-smoke / debug-valgrind / gcc / linux (push) Successful in 15s
build-dsl-smoke / debug / clang / windows (push) Successful in 15s
build-dsl-smoke / debug / msvc / windows (push) Successful in 19s
build-dsl-smoke / release / clang / windows (push) Successful in 18s
build-dsl-smoke / release / msvc / windows (push) Successful in 18s
build-dsl-smoke / SUMMARY (push) Successful in 4s
- Move Matcher types and matching logic from runner/matcher.go into the dsl package as methods on the Matcher types. Runner now calls t.Stdout.Match(label, actual) instead of type-switching via a package-level applyMatcher helper. - Replace custom contains/containsString helpers with slices.Contains in dsl/build.go and runner/compiler.go. - Use maps.Copy instead of manual map copy in BuildConfig.MergeFrom. - Adopt strings.SplitSeq, strings.CutPrefix and the `for range N` loop form in runner/limiter_linux.go. - Ignore example/imdb build artifact.
This commit is contained in:
43
dsl/ast.go
43
dsl/ast.go
@@ -1,6 +1,8 @@
|
||||
package dsl
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type File struct {
|
||||
Build string
|
||||
@@ -74,42 +76,3 @@ type Test struct {
|
||||
Stderr Matcher
|
||||
OutFiles map[string]string
|
||||
}
|
||||
|
||||
type Matcher interface {
|
||||
matcherNode()
|
||||
}
|
||||
|
||||
type ExactMatcher struct {
|
||||
Value string
|
||||
}
|
||||
|
||||
func (ExactMatcher) matcherNode() {}
|
||||
|
||||
type ContainsMatcher struct {
|
||||
Substr string
|
||||
}
|
||||
|
||||
func (ContainsMatcher) matcherNode() {}
|
||||
|
||||
type RegexMatcher struct {
|
||||
Pattern string
|
||||
}
|
||||
|
||||
func (RegexMatcher) matcherNode() {}
|
||||
|
||||
type NumericEpsMatcher struct {
|
||||
Epsilon float64
|
||||
Value string
|
||||
}
|
||||
|
||||
func (NumericEpsMatcher) matcherNode() {}
|
||||
|
||||
type AnyOrderMatcher struct {
|
||||
Lines []string
|
||||
}
|
||||
|
||||
func (AnyOrderMatcher) matcherNode() {}
|
||||
|
||||
type NoMatcher struct{}
|
||||
|
||||
func (NoMatcher) matcherNode() {}
|
||||
|
||||
Reference in New Issue
Block a user