1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:07:45 +00:00

LibJS: Add a very basic test runner (shell script) + some tests

This commit is contained in:
Andreas Kling 2020-03-25 14:26:31 +01:00
parent a94a150df0
commit 45488401b1
5 changed files with 93 additions and 0 deletions

26
Libraries/LibJS/Tests/run-tests Executable file
View file

@ -0,0 +1,26 @@
#!/bin/bash
if [ "`uname`" = "SerenityOS" ]; then
js_program=/bin/js
else
[ -z "$js_program" ] && js_program="$SERENITY_ROOT/Meta/Lagom/build/js"
fi
pass_count=0
fail_count=0
count=0
for f in *.js; do
echo -n $f:
result=`$js_program $f`
if [ "$result" = "PASS" ]; then
let pass_count++
echo -e "\033[32;1mPASS\033[0m"
else
echo -e "\033[31;1mFAIL\033[0m"
let fail_count++
fi
let count++
done
echo -e "Ran $count tests, Passed: \033[32;1m$pass_count\033[0m, Failed: \033[31;1m$fail_count\033[0m"