21 lines
511 B
Nu
Executable File
21 lines
511 B
Nu
Executable File
#!/usr/bin/env nu
|
|
|
|
# Usage: ./util.nu 0-go.txt
|
|
|
|
def main [testfile: string] {
|
|
let test_path = $"testing/tests/($testfile)"
|
|
let expected_path = $"testing/expected/($testfile)"
|
|
let exec = "./build/ps1"
|
|
|
|
# Run program and capture output
|
|
let actual = (open $test_path | ^$exec | str trim)
|
|
let expected = (open $expected_path | str trim)
|
|
|
|
# Compare outputs
|
|
if $actual == $expected {
|
|
print $"✓ ($testfile) passed"
|
|
} else {
|
|
print $"✗ ($testfile) failed"
|
|
}
|
|
}
|