Compare commits

...

3 commits

Author SHA1 Message Date
TF Renovate Bot
8bbecf896b Merge branch 'renovate/lock-file-maintenance' into 'main'
chore(deps): lock file maintenance

See merge request TECHNOFAB/nixtest!11
2026-03-27 16:03:36 +00:00
43f4f33838
chore: remove colored diff since its buggy anyways 2026-03-27 16:16:51 +01:00
fe5d9f421e
fix(scriptHelpers): remove \n from echo & fix not_contains failing shell 2026-03-27 15:56:33 +01:00
2 changed files with 9 additions and 16 deletions

View file

@ -10,7 +10,6 @@ import (
"github.com/jedib0t/go-pretty/v6/table"
"github.com/jedib0t/go-pretty/v6/text"
"github.com/rs/zerolog/log"
"github.com/sergi/go-diff/diffmatchpatch"
"gitlab.com/TECHNOFAB/nixtest/internal/types"
"gitlab.com/TECHNOFAB/nixtest/internal/util"
)
@ -25,17 +24,11 @@ func PrintErrors(results types.Results, noColor bool) {
fmt.Println(text.FgRed.Sprintf("⚠ Test \"%s/%s\" failed:", result.Spec.Suite, result.Spec.Name))
message := result.ErrorMessage
if result.Status == types.StatusFailure && message == "" {
if noColor {
var err error
message, err = util.ComputeDiff(result.Expected, result.Actual)
if err != nil {
log.Panic().Err(err).Msg("failed to compute diff")
}
} else {
dmp := diffmatchpatch.New()
diffs := dmp.DiffMain(result.Expected, result.Actual, true)
message = fmt.Sprintf("Diff:\n%s", dmp.DiffPrettyText(diffs))
}
}
if message == "" {

View file

@ -11,16 +11,16 @@ function assert_not_eq() {
assert "$1 -ne $2" "$3"
}
function assert_contains() {
echo "$1" | grep -q -- "$2" || {
echo "Assertion failed: $3. $1 does not contain $2" >&2;
echo -n "$1" | grep -q -- "$2" || {
echo "Assertion failed: $3. The following does not contain $2: $1" >&2;
exit 1;
}
}
function assert_not_contains() {
echo "$1" | grep -q -- "$2" && {
echo "Assertion failed: $3. $1 does contain $2" >&2;
echo -n "$1" | grep -q -- "$2" && {
echo "Assertion failed: $3. The following does contain $2: $1" >&2;
exit 1;
}
} || true
}
function assert_file_contains() {
grep -q -- "$2" $1 || {