chore: allow setting pos for entire suite & remove column from pos

This commit is contained in:
technofab 2025-05-10 22:14:56 +02:00
parent e029fae0b8
commit 4aaaf32621
3 changed files with 59 additions and 44 deletions

View file

@ -44,45 +44,43 @@
nixtest = {
skip = "skip.*d";
suites = {
"suite-one" = [
{
name = "test-one";
# required to figure out file and line, but optional
pos = __curPos;
expected = 1;
actual = 1;
}
{
name = "fail";
pos = __curPos;
expected = 0;
actual = "meow";
}
{
name = "snapshot-test";
type = "snapshot";
pos = __curPos;
actual = "test";
}
{
name = "test-snapshot-drv";
type = "snapshot";
pos = __curPos;
actualDrv = pkgs.runCommand "test-snapshot" {} ''
echo '"snapshot drv"' > $out
'';
}
{
name = "test-error-drv";
pos = __curPos;
expected = null;
actualDrv = pkgs.runCommand "test-error-drv" {} ''
echo "This works, but its better to just write 'fail' to \$out and expect 'success' or sth."
exit 1
'';
}
];
"other-suite" = [
"suite-one" = {
pos = __curPos;
tests = [
{
name = "test-one";
# required to figure out file and line, but optional
expected = 1;
actual = 1;
}
{
name = "fail";
expected = 0;
actual = "meow";
}
{
name = "snapshot-test";
type = "snapshot";
actual = "test";
}
{
name = "test-snapshot-drv";
type = "snapshot";
actualDrv = pkgs.runCommand "test-snapshot" {} ''
echo '"snapshot drv"' > $out
'';
}
{
name = "test-error-drv";
expected = null;
actualDrv = pkgs.runCommand "test-error-drv" {} ''
echo "This works, but its better to just write 'fail' to \$out and expect 'success' or sth."
exit 1
'';
}
];
};
"other-suite".tests = [
{
name = "obj-snapshot";
type = "snapshot";
@ -93,6 +91,7 @@
name = "pretty-snapshot";
type = "snapshot";
format = "pretty";
pos = __curPos;
actual = {
example = args: {};
example2 = {
@ -112,7 +111,6 @@
}
{
name = "skipped";
pos = __curPos;
expected = null;
actual = null;
}