Created
August 6, 2024 10:04
-
-
Save Mte90/5f4ccb36907ff0d6f2f36ed9c499d2c0 to your computer and use it in GitHub Desktop.
Shellcheck all the stdlib tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { split, contains } from "std/text" | |
import { file_write, file_append, dir_exist, file_exist, create_dir } from "std/fs" | |
let path = "/tmp/amber-sc-tests" | |
if (not dir_exist(path)) { | |
create_dir(path) | |
} | |
let report = "{path}/report.txt" | |
unsafe file_write(report, "Report for Shellcheck") | |
let output = "" | |
let stdtests = unsafe $/usr/bin/ls "src/tests/stdlib/"$ | |
let stdlib = split(stdtests, "\n") | |
loop v in stdlib { | |
if (not contains(v, ".txt") and file_exist("src/tests/stdlib/{v}")) { | |
echo "Generating Bash script for test {v}" | |
unsafe { | |
unsafe $./target/debug/amber "src/tests/stdlib/{v}" "{path}/{v}.sh"$ | |
output = unsafe $shellcheck "{path}/{v}.sh"$ | |
} | |
if (status != 0) { | |
echo "Shellcheck found something!" | |
unsafe file_append(report, output) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment