Fix around half of the basic tests
This commit is contained in:
parent
f93a7e2aed
commit
da7940061f
|
@ -13,7 +13,10 @@ export interface LangConfig {
|
||||||
createEmpty?: string;
|
createEmpty?: string;
|
||||||
compile?: string;
|
compile?: string;
|
||||||
run: string;
|
run: string;
|
||||||
|
helloInput?: string;
|
||||||
hello?: string;
|
hello?: string;
|
||||||
|
runReplInput?: string;
|
||||||
|
runReplOutput?: string;
|
||||||
scope?: {
|
scope?: {
|
||||||
code: string;
|
code: string;
|
||||||
after?: string;
|
after?: string;
|
||||||
|
@ -82,6 +85,7 @@ end Main;
|
||||||
apl: {
|
apl: {
|
||||||
name: "APL",
|
name: "APL",
|
||||||
repl: "apl",
|
repl: "apl",
|
||||||
|
input: "123 × 234",
|
||||||
main: "main.apl",
|
main: "main.apl",
|
||||||
run: "apl -f main.apl",
|
run: "apl -f main.apl",
|
||||||
template: `'Hello, world!'
|
template: `'Hello, world!'
|
||||||
|
@ -141,6 +145,7 @@ implement main0 () = ()
|
||||||
name: "Bash",
|
name: "Bash",
|
||||||
monacoLang: "shell",
|
monacoLang: "shell",
|
||||||
repl: "bash --rcfile /dev/null",
|
repl: "bash --rcfile /dev/null",
|
||||||
|
input: `expr 123 \\* 234`,
|
||||||
main: "main.bash",
|
main: "main.bash",
|
||||||
run: "bash --rcfile main.bash",
|
run: "bash --rcfile main.bash",
|
||||||
lsp: { start: "bash-language-server start" },
|
lsp: { start: "bash-language-server start" },
|
||||||
|
@ -151,6 +156,7 @@ implement main0 () = ()
|
||||||
aliases: ["bas", "qbasic"],
|
aliases: ["bas", "qbasic"],
|
||||||
name: "BASIC",
|
name: "BASIC",
|
||||||
repl: "bwbasic",
|
repl: "bwbasic",
|
||||||
|
input: "PRINT 123 * 234",
|
||||||
main: "main.bas",
|
main: "main.bas",
|
||||||
run: "bwbasic main.bas",
|
run: "bwbasic main.bas",
|
||||||
template: `PRINT "Hello, world!"
|
template: `PRINT "Hello, world!"
|
||||||
|
@ -278,8 +284,12 @@ Nude pagoda careens.
|
||||||
aliases: ["brainfuck", "bf"],
|
aliases: ["brainfuck", "bf"],
|
||||||
name: "Brainf***",
|
name: "Brainf***",
|
||||||
repl: "brainf-repl",
|
repl: "brainf-repl",
|
||||||
|
input:
|
||||||
|
">++>+[>++++[-<++++>]<<]> [>>+>+<<<-]>>>[<<<+>>>-]<<+>[<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]++++++++[<++++++>-]>[<<+>>-]>[<<+>>-]<<]>]<[->>++++++++[<++++++>-]]<[.[-]<]<",
|
||||||
|
output: "86",
|
||||||
main: "main.bf",
|
main: "main.bf",
|
||||||
run: "brainf-repl main.bf",
|
run: "brainf-repl main.bf",
|
||||||
|
hello: "Hello World",
|
||||||
template: `++++++++
|
template: `++++++++
|
||||||
[
|
[
|
||||||
>++++
|
>++++
|
||||||
|
@ -343,6 +353,7 @@ int main() {
|
||||||
name: "Chef",
|
name: "Chef",
|
||||||
main: "main.chef",
|
main: "main.chef",
|
||||||
run: "chef main.chef",
|
run: "chef main.chef",
|
||||||
|
hello: "Hello world!",
|
||||||
template: `Hello World Cake with Chocolate Sauce.
|
template: `Hello World Cake with Chocolate Sauce.
|
||||||
|
|
||||||
Ingredients.
|
Ingredients.
|
||||||
|
@ -407,6 +418,7 @@ Refrigerate for 1 hour.
|
||||||
name: "Cmd",
|
name: "Cmd",
|
||||||
monacoLang: "bat",
|
monacoLang: "bat",
|
||||||
repl: "wine cmd",
|
repl: "wine cmd",
|
||||||
|
input: "set /a 123 * 234",
|
||||||
main: "main.bat",
|
main: "main.bat",
|
||||||
run: `wine cmd /k main.bat`,
|
run: `wine cmd /k main.bat`,
|
||||||
template: `echo "Hello, world!"
|
template: `echo "Hello, world!"
|
||||||
|
@ -499,6 +511,7 @@ int main() {
|
||||||
name: "Clojure",
|
name: "Clojure",
|
||||||
monacoLang: "clojure",
|
monacoLang: "clojure",
|
||||||
repl: "clojure",
|
repl: "clojure",
|
||||||
|
input: "(* 123 234)",
|
||||||
main: "main.clj",
|
main: "main.clj",
|
||||||
run: "clojure -i main.clj -r",
|
run: "clojure -i main.clj -r",
|
||||||
lsp: { start: "clojure-lsp" },
|
lsp: { start: "clojure-lsp" },
|
||||||
|
@ -510,6 +523,7 @@ int main() {
|
||||||
name: "ClojureScript",
|
name: "ClojureScript",
|
||||||
monacoLang: "clojure",
|
monacoLang: "clojure",
|
||||||
repl: "lumo -r",
|
repl: "lumo -r",
|
||||||
|
input: "(* 123 234)",
|
||||||
main: "main.cljs",
|
main: "main.cljs",
|
||||||
run: "lumo -i main.cljs -r",
|
run: "lumo -i main.cljs -r",
|
||||||
template: `(println "Hello, world!")
|
template: `(println "Hello, world!")
|
||||||
|
@ -622,6 +636,7 @@ output = "Hello, world!"
|
||||||
aliases: ["elv"],
|
aliases: ["elv"],
|
||||||
name: "Elvish",
|
name: "Elvish",
|
||||||
repl: `SHELL=/usr/bin/elvish HOME="$PWD" elvish`,
|
repl: `SHELL=/usr/bin/elvish HOME="$PWD" elvish`,
|
||||||
|
input: `expr 123 "*" 234`,
|
||||||
main: ".elvish/rc.elv",
|
main: ".elvish/rc.elv",
|
||||||
createEmpty: ``,
|
createEmpty: ``,
|
||||||
run: `SHELL=/usr/bin/elvish HOME="$PWD" elvish`,
|
run: `SHELL=/usr/bin/elvish HOME="$PWD" elvish`,
|
||||||
|
@ -632,6 +647,7 @@ output = "Hello, world!"
|
||||||
aliases: ["emacslisp", "elisp", "gnuemacs", "xemacs", "ielm"],
|
aliases: ["emacslisp", "elisp", "gnuemacs", "xemacs", "ielm"],
|
||||||
name: "Emacs Lisp",
|
name: "Emacs Lisp",
|
||||||
repl: `emacs --eval "(progn (require 'package) (push '(\"melpa\" . \"https://melpa.org/packages/\") package-archives) (package-initialize) (ielm))"`,
|
repl: `emacs --eval "(progn (require 'package) (push '(\"melpa\" . \"https://melpa.org/packages/\") package-archives) (package-initialize) (ielm))"`,
|
||||||
|
input: "(* 123 234)",
|
||||||
main: "main.el",
|
main: "main.el",
|
||||||
run: `emacs --load main.el --eval "(progn (require 'package) (push '(\"melpa\" . \"https://melpa.org/packages/\") package-archives) (package-initialize) (ielm))"`,
|
run: `emacs --load main.el --eval "(progn (require 'package) (push '(\"melpa\" . \"https://melpa.org/packages/\") package-archives) (package-initialize) (ielm))"`,
|
||||||
pkg: {
|
pkg: {
|
||||||
|
@ -668,6 +684,7 @@ output = "Hello, world!"
|
||||||
aliases: ["erl"],
|
aliases: ["erl"],
|
||||||
name: "Erlang",
|
name: "Erlang",
|
||||||
repl: "erl",
|
repl: "erl",
|
||||||
|
input: "123 * 234.",
|
||||||
main: "main.erl",
|
main: "main.erl",
|
||||||
compile: "erl -compile main",
|
compile: "erl -compile main",
|
||||||
run: "erl -s main main",
|
run: "erl -s main main",
|
||||||
|
@ -691,6 +708,7 @@ main() ->
|
||||||
aliases: ["fact"],
|
aliases: ["fact"],
|
||||||
name: "Factor",
|
name: "Factor",
|
||||||
repl: "factor-lang",
|
repl: "factor-lang",
|
||||||
|
input: "123 234 *",
|
||||||
main: ".factor-rc",
|
main: ".factor-rc",
|
||||||
createEmpty: ``,
|
createEmpty: ``,
|
||||||
run: "factor-lang",
|
run: "factor-lang",
|
||||||
|
@ -702,6 +720,7 @@ main() ->
|
||||||
fish: {
|
fish: {
|
||||||
name: "Fish",
|
name: "Fish",
|
||||||
repl: "SHELL=/usr/bin/fish fish",
|
repl: "SHELL=/usr/bin/fish fish",
|
||||||
|
input: `expr 123 \\* 234`,
|
||||||
main: "main.fish",
|
main: "main.fish",
|
||||||
run: 'SHELL=/usr/bin/fish fish -C "$(< main.fish)"',
|
run: 'SHELL=/usr/bin/fish fish -C "$(< main.fish)"',
|
||||||
template: `echo "Hello, world!"
|
template: `echo "Hello, world!"
|
||||||
|
@ -711,6 +730,7 @@ main() ->
|
||||||
aliases: ["fs", "gforth"],
|
aliases: ["fs", "gforth"],
|
||||||
name: "Forth",
|
name: "Forth",
|
||||||
repl: "gforth",
|
repl: "gforth",
|
||||||
|
input: ". 123 234 *",
|
||||||
main: "main.fs",
|
main: "main.fs",
|
||||||
run: "gforth main.fs",
|
run: "gforth main.fs",
|
||||||
template: `." Hello, world!" CR
|
template: `." Hello, world!" CR
|
||||||
|
@ -741,6 +761,7 @@ main() ->
|
||||||
name: "F#",
|
name: "F#",
|
||||||
monacoLang: "fsharp",
|
monacoLang: "fsharp",
|
||||||
repl: "fsharpi",
|
repl: "fsharpi",
|
||||||
|
input: "123 * 234 ;;",
|
||||||
main: "main.fsx",
|
main: "main.fsx",
|
||||||
run: "fsharpi --use:main.fsx",
|
run: "fsharpi --use:main.fsx",
|
||||||
template: `printfn "Hello, world!"
|
template: `printfn "Hello, world!"
|
||||||
|
@ -783,8 +804,10 @@ func main() {
|
||||||
hack: {
|
hack: {
|
||||||
name: "Hack",
|
name: "Hack",
|
||||||
repl: "hhvm -a",
|
repl: "hhvm -a",
|
||||||
|
input: "print 123 * 234",
|
||||||
main: "main.hack",
|
main: "main.hack",
|
||||||
run: "hhvm -a main.hack",
|
run: "hhvm -a main.hack",
|
||||||
|
helloInput: "r",
|
||||||
template: `<<__EntryPoint>>
|
template: `<<__EntryPoint>>
|
||||||
function main(): void {
|
function main(): void {
|
||||||
echo "Hello, world!\\n";
|
echo "Hello, world!\\n";
|
||||||
|
@ -850,6 +873,7 @@ l ; ; o ; * 4
|
||||||
hy: {
|
hy: {
|
||||||
name: "Hy",
|
name: "Hy",
|
||||||
repl: "hy",
|
repl: "hy",
|
||||||
|
input: "(* 123 234)",
|
||||||
main: "main.hy",
|
main: "main.hy",
|
||||||
run: "hy -i main.hy",
|
run: "hy -i main.hy",
|
||||||
template: `(print "Hello, world!")
|
template: `(print "Hello, world!")
|
||||||
|
@ -947,6 +971,7 @@ PLEASE GIVE UP
|
||||||
aliases: ["ktn"],
|
aliases: ["ktn"],
|
||||||
name: "Kitten",
|
name: "Kitten",
|
||||||
repl: "kitten",
|
repl: "kitten",
|
||||||
|
input: "(123 * 234) say",
|
||||||
main: "main.ktn",
|
main: "main.ktn",
|
||||||
run: "kitten main.ktn; kitten",
|
run: "kitten main.ktn; kitten",
|
||||||
template: `"Hello, world!" say
|
template: `"Hello, world!" say
|
||||||
|
@ -956,9 +981,9 @@ PLEASE GIVE UP
|
||||||
aliases: ["kts", "kotlinc"],
|
aliases: ["kts", "kotlinc"],
|
||||||
name: "Kotlin",
|
name: "Kotlin",
|
||||||
monacoLang: "kotlin",
|
monacoLang: "kotlin",
|
||||||
repl: "kotlinc",
|
repl: `JAVA_OPTS="-Duser.home=$PWD" kotlinc`,
|
||||||
main: "main.kts",
|
main: "main.kts",
|
||||||
run: "kotlinc -script main.kts; kotlinc",
|
run: `JAVA_OPTS="-Duser.home=$PWD" kotlinc -script main.kts; kotlinc`,
|
||||||
template: `println("Hello, world!")
|
template: `println("Hello, world!")
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
|
@ -967,6 +992,7 @@ PLEASE GIVE UP
|
||||||
name: "Ksh",
|
name: "Ksh",
|
||||||
monacoLang: "shell",
|
monacoLang: "shell",
|
||||||
repl: `SHELL=/usr/bin/ksh HOME="$PWD" ksh`,
|
repl: `SHELL=/usr/bin/ksh HOME="$PWD" ksh`,
|
||||||
|
input: "expr 123 * 234",
|
||||||
main: ".kshrc",
|
main: ".kshrc",
|
||||||
createEmpty: ``,
|
createEmpty: ``,
|
||||||
run: `SHELL=/usr/bin/ksh HOME="$PWD" ksh`,
|
run: `SHELL=/usr/bin/ksh HOME="$PWD" ksh`,
|
||||||
|
@ -990,6 +1016,7 @@ PLEASE GIVE UP
|
||||||
name: "LiveScript",
|
name: "LiveScript",
|
||||||
repl: "lsc",
|
repl: "lsc",
|
||||||
main: "main.ls",
|
main: "main.ls",
|
||||||
|
hello: "Hello World",
|
||||||
run: "lsc -r ./main.ls; lsc",
|
run: "lsc -r ./main.ls; lsc",
|
||||||
template: `console.log "Hello, world!"
|
template: `console.log "Hello, world!"
|
||||||
`,
|
`,
|
||||||
|
@ -1043,9 +1070,10 @@ KTHXBYE
|
||||||
aliases: ["maria"],
|
aliases: ["maria"],
|
||||||
name: "MariaDB",
|
name: "MariaDB",
|
||||||
repl: `rm -rf data && /opt/mariadb/scripts/mariadb-install-db --user="$(id -un)" && (/opt/mariadb/bin/mysqld --datadir="$PWD/data" --socket="$PWD/socket" --skip-networking &) && until [[ -e socket ]]; do sleep 0.01; done && mysql --socket="$PWD/socket"`,
|
repl: `rm -rf data && /opt/mariadb/scripts/mariadb-install-db --user="$(id -un)" && (/opt/mariadb/bin/mysqld --datadir="$PWD/data" --socket="$PWD/socket" --skip-networking &) && until [[ -e socket ]]; do sleep 0.01; done && mysql --socket="$PWD/socket"`,
|
||||||
|
input: "SELECT 123 * 234;",
|
||||||
main: "main.sql",
|
main: "main.sql",
|
||||||
run: `rm -rf data && /opt/mariadb/scripts/mariadb-install-db --user="$(id -un)" && (/opt/mariadb/bin/mysqld --datadir="$PWD/data" --socket="$PWD/socket" --skip-networking &) && until [[ -e socket ]]; do sleep 0.01; done && (mysql --socket="$PWD/socket" < main.sql; mysql --socket="$PWD/socket")`,
|
run: `rm -rf data && /opt/mariadb/scripts/mariadb-install-db --user="$(id -un)" && (/opt/mariadb/bin/mysqld --datadir="$PWD/data" --socket="$PWD/socket" --skip-networking &) && until [[ -e socket ]]; do sleep 0.01; done && (mysql --socket="$PWD/socket" < main.sql; mysql --socket="$PWD/socket")`,
|
||||||
template: `SELECT 'Hello, world!'
|
template: `SELECT 'Hello, world!';
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
markdown: {
|
markdown: {
|
||||||
|
@ -1125,9 +1153,10 @@ message:
|
||||||
aliases: ["my"],
|
aliases: ["my"],
|
||||||
name: "MySQL",
|
name: "MySQL",
|
||||||
repl: `rm -rf data && mysqld -h "$PWD/data" --initialize-insecure && (mysqld -h "$PWD/data" --socket="$PWD/socket" --pid-file="$PWD/pid-file" --mysqlx=OFF --skip-networking &) && until [[ -e socket ]]; do sleep 0.01; done && mysql --socket="$PWD/socket" -u root`,
|
repl: `rm -rf data && mysqld -h "$PWD/data" --initialize-insecure && (mysqld -h "$PWD/data" --socket="$PWD/socket" --pid-file="$PWD/pid-file" --mysqlx=OFF --skip-networking &) && until [[ -e socket ]]; do sleep 0.01; done && mysql --socket="$PWD/socket" -u root`,
|
||||||
|
input: "SELECT 123 * 234;",
|
||||||
main: "main.sql",
|
main: "main.sql",
|
||||||
run: `rm -rf data && mysqld -h "$PWD/data" --initialize-insecure && (mysqld -h "$PWD/data" --socket="$PWD/socket" --pid-file="$PWD/pid-file" --mysqlx=OFF --skip-networking &) && until [[ -e socket ]]; do sleep 0.01; done && (mysql --socket="$PWD/socket" -u root < main.sql; mysql --socket="$PWD/socket" -u root)`,
|
run: `rm -rf data && mysqld -h "$PWD/data" --initialize-insecure && (mysqld -h "$PWD/data" --socket="$PWD/socket" --pid-file="$PWD/pid-file" --mysqlx=OFF --skip-networking &) && until [[ -e socket ]]; do sleep 0.01; done && (mysql --socket="$PWD/socket" -u root < main.sql; mysql --socket="$PWD/socket" -u root)`,
|
||||||
template: `SELECT 'Hello, world!'
|
template: `SELECT 'Hello, world!';
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
nim: {
|
nim: {
|
||||||
|
@ -1185,6 +1214,7 @@ int main() {
|
||||||
name: "OCaml",
|
name: "OCaml",
|
||||||
main: "main.ml",
|
main: "main.ml",
|
||||||
repl: "ocaml",
|
repl: "ocaml",
|
||||||
|
input: "123 * 234 ;;",
|
||||||
run: "ocaml -init main.ml",
|
run: "ocaml -init main.ml",
|
||||||
format: { run: "ocamlformat main.ml" },
|
format: { run: "ocamlformat main.ml" },
|
||||||
lsp: { start: "ocamllsp", lang: "ocaml" },
|
lsp: { start: "ocamllsp", lang: "ocaml" },
|
||||||
|
@ -1270,7 +1300,9 @@ end.
|
||||||
name: "PHP",
|
name: "PHP",
|
||||||
monacoLang: "php",
|
monacoLang: "php",
|
||||||
repl: "php -a",
|
repl: "php -a",
|
||||||
|
input: "print 123 * 234;",
|
||||||
main: "main.php",
|
main: "main.php",
|
||||||
|
hello: "Hello World!",
|
||||||
run: "php -d auto_prepend_file=main.php -a",
|
run: "php -d auto_prepend_file=main.php -a",
|
||||||
lsp: { start: "intelephense --stdio" },
|
lsp: { start: "intelephense --stdio" },
|
||||||
template: `<?php
|
template: `<?php
|
||||||
|
@ -1308,6 +1340,7 @@ pipi pikachu
|
||||||
name: "PostgreSQL",
|
name: "PostgreSQL",
|
||||||
monacoLang: "pgsql",
|
monacoLang: "pgsql",
|
||||||
repl: `rm -rf data && /usr/lib/postgresql/*/bin/initdb -D data && (echo "listen_addresses = ''" && echo "unix_socket_directories = '.'") >> data/postgresql.conf && /usr/lib/postgresql/*/bin/pg_ctl -D data -w start && psql -h "$PWD/data" postgres`,
|
repl: `rm -rf data && /usr/lib/postgresql/*/bin/initdb -D data && (echo "listen_addresses = ''" && echo "unix_socket_directories = '.'") >> data/postgresql.conf && /usr/lib/postgresql/*/bin/pg_ctl -D data -w start && psql -h "$PWD/data" postgres`,
|
||||||
|
input: "SELECT 123 * 234;",
|
||||||
main: "main.sql",
|
main: "main.sql",
|
||||||
run: `rm -rf data && /usr/lib/postgresql/*/bin/initdb -D data && (echo "listen_addresses = ''" && echo "unix_socket_directories = '.'") >> data/postgresql.conf && /usr/lib/postgresql/*/bin/pg_ctl -D data -w start && (psql -h "$PWD/data" postgres -f main.sql; psql -h "$PWD/data" postgres)`,
|
run: `rm -rf data && /usr/lib/postgresql/*/bin/initdb -D data && (echo "listen_addresses = ''" && echo "unix_socket_directories = '.'") >> data/postgresql.conf && /usr/lib/postgresql/*/bin/pg_ctl -D data -w start && (psql -h "$PWD/data" postgres -f main.sql; psql -h "$PWD/data" postgres)`,
|
||||||
template: `SELECT 'Hello, world!';
|
template: `SELECT 'Hello, world!';
|
||||||
|
@ -1318,6 +1351,7 @@ pipi pikachu
|
||||||
name: "PowerShell",
|
name: "PowerShell",
|
||||||
monacoLang: "powershell",
|
monacoLang: "powershell",
|
||||||
repl: "SHELL=/usr/bin/pwsh pwsh",
|
repl: "SHELL=/usr/bin/pwsh pwsh",
|
||||||
|
input: `expr 123 "*" 234`,
|
||||||
main: "main.ps1",
|
main: "main.ps1",
|
||||||
run: "SHELL=/usr/bin/pwsh pwsh -NoExit main.ps1",
|
run: "SHELL=/usr/bin/pwsh pwsh -NoExit main.ps1",
|
||||||
lsp: {
|
lsp: {
|
||||||
|
@ -1329,6 +1363,7 @@ pipi pikachu
|
||||||
prolog: {
|
prolog: {
|
||||||
name: "Prolog",
|
name: "Prolog",
|
||||||
repl: "prolog",
|
repl: "prolog",
|
||||||
|
input: "ANS is 123 * 234.",
|
||||||
main: "main.pl",
|
main: "main.pl",
|
||||||
run: "prolog main.pl",
|
run: "prolog main.pl",
|
||||||
template: `:- initialization main.
|
template: `:- initialization main.
|
||||||
|
@ -1403,7 +1438,9 @@ main = do
|
||||||
aliases: ["qalb"],
|
aliases: ["qalb"],
|
||||||
name: "قلب",
|
name: "قلب",
|
||||||
repl: "node /opt/qalb/repl.js",
|
repl: "node /opt/qalb/repl.js",
|
||||||
|
input: "(ضرب ١٢٣ ٢٣٤)",
|
||||||
main: "main.qalb",
|
main: "main.qalb",
|
||||||
|
hello: "قو",
|
||||||
run: "node /opt/qalb/repl.js main.qalb",
|
run: "node /opt/qalb/repl.js main.qalb",
|
||||||
template: `(قول "مرحبا يا عالم")
|
template: `(قول "مرحبا يا عالم")
|
||||||
`,
|
`,
|
||||||
|
@ -1422,6 +1459,7 @@ main = do
|
||||||
aliases: ["rkt"],
|
aliases: ["rkt"],
|
||||||
name: "Racket",
|
name: "Racket",
|
||||||
repl: "racket",
|
repl: "racket",
|
||||||
|
input: "(* 123 234)",
|
||||||
main: "main.rkt",
|
main: "main.rkt",
|
||||||
run: `racket -i -e '(enter! "main.rkt") (display "[ type (enter! \\"main.rkt\\") to access local variables ]\\n")'`,
|
run: `racket -i -e '(enter! "main.rkt") (display "[ type (enter! \\"main.rkt\\") to access local variables ]\\n")'`,
|
||||||
template: `#lang racket/base
|
template: `#lang racket/base
|
||||||
|
@ -1455,6 +1493,7 @@ main = do
|
||||||
monacoLang: "redis",
|
monacoLang: "redis",
|
||||||
repl:
|
repl:
|
||||||
"rm -f socket; (redis-server --port 0 --unixsocket socket &); until [[ -e socket ]]; do sleep 0.01; done; redis-cli -s socket",
|
"rm -f socket; (redis-server --port 0 --unixsocket socket &); until [[ -e socket ]]; do sleep 0.01; done; redis-cli -s socket",
|
||||||
|
input: `EVAL "return 123 * 234" 0`,
|
||||||
main: "main.redis",
|
main: "main.redis",
|
||||||
run:
|
run:
|
||||||
"rm -f socket; (redis-server --port 0 --unixsocket socket &); until [[ -e socket ]]; do sleep 0.01; done; redis-cli -s socket < main.redis; redis-cli -s socket",
|
"rm -f socket; (redis-server --port 0 --unixsocket socket &); until [[ -e socket ]]; do sleep 0.01; done; redis-cli -s socket < main.redis; redis-cli -s socket",
|
||||||
|
@ -1577,6 +1616,7 @@ binding_irb.run(IRB.conf)
|
||||||
name: "Scheme",
|
name: "Scheme",
|
||||||
monacoLang: "scheme",
|
monacoLang: "scheme",
|
||||||
repl: "mit-scheme",
|
repl: "mit-scheme",
|
||||||
|
input: "(* 123 234)",
|
||||||
main: "main.scm",
|
main: "main.scm",
|
||||||
run: "mit-scheme --load main.scm",
|
run: "mit-scheme --load main.scm",
|
||||||
template: `(begin
|
template: `(begin
|
||||||
|
@ -1599,6 +1639,7 @@ binding_irb.run(IRB.conf)
|
||||||
aliases: ["gsed"],
|
aliases: ["gsed"],
|
||||||
name: "Sed",
|
name: "Sed",
|
||||||
main: "main.sed",
|
main: "main.sed",
|
||||||
|
helloInput: "",
|
||||||
run: "echo 'Reading from stdin...' >&2; sed -f main.sed",
|
run: "echo 'Reading from stdin...' >&2; sed -f main.sed",
|
||||||
template: `s/.*/Hello, world!/
|
template: `s/.*/Hello, world!/
|
||||||
`,
|
`,
|
||||||
|
@ -1615,6 +1656,7 @@ binding_irb.run(IRB.conf)
|
||||||
name: "Sh",
|
name: "Sh",
|
||||||
monacoLang: "shell",
|
monacoLang: "shell",
|
||||||
repl: `SHELL=/usr/bin/sh HOME="$PWD" posh -l`,
|
repl: `SHELL=/usr/bin/sh HOME="$PWD" posh -l`,
|
||||||
|
input: `expr 123 \\* 234`,
|
||||||
main: ".profile",
|
main: ".profile",
|
||||||
createEmpty: ``,
|
createEmpty: ``,
|
||||||
run: `SHELL=/usr/bin/sh HOME="$PWD" posh -l`,
|
run: `SHELL=/usr/bin/sh HOME="$PWD" posh -l`,
|
||||||
|
@ -1625,9 +1667,15 @@ binding_irb.run(IRB.conf)
|
||||||
aliases: ["spl"],
|
aliases: ["spl"],
|
||||||
name: "Shakespeare",
|
name: "Shakespeare",
|
||||||
repl: "shakespeare console",
|
repl: "shakespeare console",
|
||||||
|
input: `Hamlet, a placeholder.
|
||||||
|
done
|
||||||
|
stage`,
|
||||||
|
output: "Off stage",
|
||||||
main: "main.spl",
|
main: "main.spl",
|
||||||
|
hello: "Hello World!",
|
||||||
suffix: "\n[A pause]",
|
suffix: "\n[A pause]",
|
||||||
run: "shakespeare debug main.spl",
|
run: "shakespeare debug main.spl",
|
||||||
|
runReplInput: "stage",
|
||||||
template: `The Infamous Hello World Program.
|
template: `The Infamous Hello World Program.
|
||||||
|
|
||||||
Romeo, a young man with a remarkable patience.
|
Romeo, a young man with a remarkable patience.
|
||||||
|
@ -1732,6 +1780,8 @@ Ophelia:
|
||||||
aliases: ["snobol4", "spitbol", "sno"],
|
aliases: ["snobol4", "spitbol", "sno"],
|
||||||
name: "SNOBOL",
|
name: "SNOBOL",
|
||||||
repl: "snobol4",
|
repl: "snobol4",
|
||||||
|
input: ` OUTPUT = 123 * 234
|
||||||
|
END`,
|
||||||
main: "main.sno",
|
main: "main.sno",
|
||||||
run: "snobol4 main.sno; snobol4",
|
run: "snobol4 main.sno; snobol4",
|
||||||
template: ` OUTPUT = "Hello, world!"
|
template: ` OUTPUT = "Hello, world!"
|
||||||
|
@ -1743,6 +1793,7 @@ END
|
||||||
name: "SQLite",
|
name: "SQLite",
|
||||||
monacoLang: "sql",
|
monacoLang: "sql",
|
||||||
repl: "sqlite3",
|
repl: "sqlite3",
|
||||||
|
input: "SELECT 123 * 234;",
|
||||||
main: "main.sql",
|
main: "main.sql",
|
||||||
run: `sqlite3 -cmd "$(< main.sql)"`,
|
run: `sqlite3 -cmd "$(< main.sql)"`,
|
||||||
template: `SELECT 'Hello, world!';
|
template: `SELECT 'Hello, world!';
|
||||||
|
@ -1752,6 +1803,7 @@ END
|
||||||
aliases: ["sml", "ml"],
|
aliases: ["sml", "ml"],
|
||||||
name: "Standard ML",
|
name: "Standard ML",
|
||||||
repl: "rlwrap sml",
|
repl: "rlwrap sml",
|
||||||
|
input: "123 * 234;",
|
||||||
main: "main.sml",
|
main: "main.sml",
|
||||||
run: "rlwrap sml main.sml",
|
run: "rlwrap sml main.sml",
|
||||||
template: `print "Hello, world!\\n";
|
template: `print "Hello, world!\\n";
|
||||||
|
@ -1773,6 +1825,7 @@ END
|
||||||
name: "Tcl",
|
name: "Tcl",
|
||||||
monacoLang: "tcl",
|
monacoLang: "tcl",
|
||||||
repl: "tclsh",
|
repl: "tclsh",
|
||||||
|
input: "expr 123 * 234",
|
||||||
main: ".tclshrc",
|
main: ".tclshrc",
|
||||||
createEmpty: ``,
|
createEmpty: ``,
|
||||||
run: `HOME="$PWD" tclsh`,
|
run: `HOME="$PWD" tclsh`,
|
||||||
|
@ -1784,6 +1837,7 @@ END
|
||||||
name: "Tcsh",
|
name: "Tcsh",
|
||||||
monacoLang: "shell",
|
monacoLang: "shell",
|
||||||
repl: `SHELL=/usr/bin/tcsh HOME="$PWD" tcsh`,
|
repl: `SHELL=/usr/bin/tcsh HOME="$PWD" tcsh`,
|
||||||
|
input: `expr 123 \\* 234`,
|
||||||
main: ".tcshrc",
|
main: ".tcshrc",
|
||||||
createEmpty: ``,
|
createEmpty: ``,
|
||||||
run: `SHELL=/usr/bin/tcsh HOME="$PWD" tcsh`,
|
run: `SHELL=/usr/bin/tcsh HOME="$PWD" tcsh`,
|
||||||
|
@ -1794,6 +1848,10 @@ END
|
||||||
aliases: ["latex", "xetex", "plaintex"],
|
aliases: ["latex", "xetex", "plaintex"],
|
||||||
name: "TeX",
|
name: "TeX",
|
||||||
repl: "tex",
|
repl: "tex",
|
||||||
|
input: `\\newcount\\ans
|
||||||
|
\\advance\\ans by 123
|
||||||
|
\\multiply\\ans by 234
|
||||||
|
\\message{\\the\\ans}`,
|
||||||
main: "main.tex",
|
main: "main.tex",
|
||||||
run: "tex main.tex",
|
run: "tex main.tex",
|
||||||
lsp: { start: "digestif", lang: "tex" },
|
lsp: { start: "digestif", lang: "tex" },
|
||||||
|
@ -1858,6 +1916,7 @@ a
|
||||||
aliases: ["unl"],
|
aliases: ["unl"],
|
||||||
name: "Unlambda",
|
name: "Unlambda",
|
||||||
repl: "unlambda-repl",
|
repl: "unlambda-repl",
|
||||||
|
input: "`.2`.8`.7`.8`.2i",
|
||||||
main: "main.unl",
|
main: "main.unl",
|
||||||
run: "unlambda-repl main.unl",
|
run: "unlambda-repl main.unl",
|
||||||
template: "`.\n`.!`.d`.l`.r`.o`.w`. `.,`.o`.l`.l`.e`.Hi\n",
|
template: "`.\n`.!`.d`.l`.r`.o`.w`. `.,`.o`.l`.l`.e`.Hi\n",
|
||||||
|
@ -1866,6 +1925,7 @@ a
|
||||||
aliases: ["viml", "vimscript"],
|
aliases: ["viml", "vimscript"],
|
||||||
name: "Vimscript",
|
name: "Vimscript",
|
||||||
repl: "vim",
|
repl: "vim",
|
||||||
|
input: ":echo 123 * 234",
|
||||||
main: "main.vim",
|
main: "main.vim",
|
||||||
run: `vim -c "$(< main.vim)"`,
|
run: `vim -c "$(< main.vim)"`,
|
||||||
lsp: { start: "vim-language-server --stdio" },
|
lsp: { start: "vim-language-server --stdio" },
|
||||||
|
@ -1899,7 +1959,8 @@ End Module
|
||||||
name: "Whitespace",
|
name: "Whitespace",
|
||||||
main: "main.ws",
|
main: "main.ws",
|
||||||
run: "whitespace main.ws",
|
run: "whitespace main.ws",
|
||||||
template: `Hello, world! \t \t \n\t\n \t\t \t \t\n\t\n \t\t \t\t \n\t\n \t\t \t\t \n\t\n \t\t \t\t\t\t\n\t\n \t \t\t \n\t\n \t \n\t\n \t\t\t \t\t\t\n\t\n \t\t \t\t\t\t\n\t\n \t\t\t \t \n\t\n \t\t \t\t \n\t\n \t\t \t \n\t\n \n\n\n`,
|
hello: "Hello, world",
|
||||||
|
template: `Hello, world \t \t \n\t\n \t\t \t \t\n\t\n \t\t \t\t \n\t\n \t\t \t\t \n\t\n \t\t \t\t\t\t\n\t\n \t \t\t \n\t\n \t \n\t\n \t\t\t \t\t\t\n\t\n \t\t \t\t\t\t\n\t\n \t\t\t \t \n\t\n \t\t \t\t \n\t\n \t\t \t \n\t\n \n\n\n`,
|
||||||
},
|
},
|
||||||
wolframlanguage: {
|
wolframlanguage: {
|
||||||
aliases: [
|
aliases: [
|
||||||
|
@ -1955,6 +2016,7 @@ message:
|
||||||
name: "Zot",
|
name: "Zot",
|
||||||
main: "main.zot",
|
main: "main.zot",
|
||||||
run: "zot --file main.zot",
|
run: "zot --file main.zot",
|
||||||
|
hello: `0100100001100101011011000110110001101111001011000010000001110111011011110111001001101100011001000010000100001010`,
|
||||||
template: `111101010100111010101001001101010010010011101010100111010101
|
template: `111101010100111010101001001101010010010011101010100111010101
|
||||||
001101010010101010011101010100110101001101010100110101001010
|
001101010010101010011101010100110101001101010100110101001010
|
||||||
101001110101010011101010100110101001010101001110101010011010
|
101001110101010011101010100110101001010101001110101010011010
|
||||||
|
@ -1984,6 +2046,7 @@ message:
|
||||||
name: "Zsh",
|
name: "Zsh",
|
||||||
monacoLang: "shell",
|
monacoLang: "shell",
|
||||||
repl: "SHELL=/usr/bin/zsh zsh",
|
repl: "SHELL=/usr/bin/zsh zsh",
|
||||||
|
input: `expr 123 \\* 234`,
|
||||||
main: ".zshrc",
|
main: ".zshrc",
|
||||||
createEmpty: ``,
|
createEmpty: ``,
|
||||||
run: `SHELL=/usr/bin/zsh ZDOTDIR="$PWD" zsh`,
|
run: `SHELL=/usr/bin/zsh ZDOTDIR="$PWD" zsh`,
|
||||||
|
|
|
@ -2,6 +2,7 @@ import * as fs from "fs";
|
||||||
import * as process from "process";
|
import * as process from "process";
|
||||||
import { promisify } from "util";
|
import { promisify } from "util";
|
||||||
|
|
||||||
|
import * as _ from "lodash";
|
||||||
import PQueue from "p-queue";
|
import PQueue from "p-queue";
|
||||||
import * as rimraf from "rimraf";
|
import * as rimraf from "rimraf";
|
||||||
import { v4 as getUUID } from "uuid";
|
import { v4 as getUUID } from "uuid";
|
||||||
|
@ -9,8 +10,8 @@ import { v4 as getUUID } from "uuid";
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import { LangConfig, langs } from "./langs";
|
import { LangConfig, langs } from "./langs";
|
||||||
|
|
||||||
const TIMEOUT_MS = 3000;
|
const TIMEOUT_MS = 5000;
|
||||||
const CONCURRENCY = 16;
|
const CONCURRENCY = 32;
|
||||||
|
|
||||||
function findPosition(str: string, idx: number) {
|
function findPosition(str: string, idx: number) {
|
||||||
const lines = str.substring(0, idx).split("\n");
|
const lines = str.substring(0, idx).split("\n");
|
||||||
|
@ -19,6 +20,10 @@ function findPosition(str: string, idx: number) {
|
||||||
return { line, character };
|
return { line, character };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function forTTY(input: string) {
|
||||||
|
return input.replace(/\n/g, "\r") + "\r";
|
||||||
|
}
|
||||||
|
|
||||||
class Test {
|
class Test {
|
||||||
lang: string;
|
lang: string;
|
||||||
type: string;
|
type: string;
|
||||||
|
@ -173,19 +178,25 @@ class Test {
|
||||||
testHello = async () => {
|
testHello = async () => {
|
||||||
const pattern = this.config.hello || "Hello, world!";
|
const pattern = this.config.hello || "Hello, world!";
|
||||||
this.send({ event: "runCode", code: this.config.template });
|
this.send({ event: "runCode", code: this.config.template });
|
||||||
|
if (this.config.helloInput !== undefined) {
|
||||||
|
this.send({
|
||||||
|
event: "terminalInput",
|
||||||
|
input: forTTY(this.config.helloInput),
|
||||||
|
});
|
||||||
|
}
|
||||||
await this.waitForOutput(pattern);
|
await this.waitForOutput(pattern);
|
||||||
};
|
};
|
||||||
testRepl = async () => {
|
testRepl = async () => {
|
||||||
const input = this.config.input || "111111 + 111111";
|
const input = this.config.input || "123 * 234";
|
||||||
const output = this.config.output || "222222";
|
const output = this.config.output || "28782";
|
||||||
this.send({ event: "terminalInput", input: input + "\r" });
|
this.send({ event: "terminalInput", input: forTTY(input) });
|
||||||
await this.waitForOutput(output);
|
await this.waitForOutput(output);
|
||||||
};
|
};
|
||||||
testRunRepl = async () => {
|
testRunRepl = async () => {
|
||||||
const input = this.config.input || "111111 + 111111";
|
const input = this.config.runReplInput || this.config.input || "123 * 234";
|
||||||
const output = this.config.output || "222222";
|
const output = this.config.runReplOutput || this.config.output || "28782";
|
||||||
this.send({ event: "runCode", code: this.config.template });
|
this.send({ event: "runCode", code: this.config.template });
|
||||||
this.send({ event: "terminalInput", input: input + "\r" });
|
this.send({ event: "terminalInput", input: forTTY(input) });
|
||||||
await this.waitForOutput(output);
|
await this.waitForOutput(output);
|
||||||
};
|
};
|
||||||
testScope = async () => {
|
testScope = async () => {
|
||||||
|
@ -203,7 +214,7 @@ class Test {
|
||||||
allCode = allCode + code + "\n";
|
allCode = allCode + code + "\n";
|
||||||
}
|
}
|
||||||
this.send({ event: "runCode", code: allCode });
|
this.send({ event: "runCode", code: allCode });
|
||||||
this.send({ event: "terminalInput", input: input + "\r" });
|
this.send({ event: "terminalInput", input: forTTY(input) });
|
||||||
await this.waitForOutput(output);
|
await this.waitForOutput(output);
|
||||||
};
|
};
|
||||||
testFormat = async () => {
|
testFormat = async () => {
|
||||||
|
@ -659,7 +670,10 @@ async function main() {
|
||||||
}
|
}
|
||||||
if (failed.size > 0) {
|
if (failed.size > 0) {
|
||||||
console.error(`${failed.size} test${failed.size !== 1 ? "s" : ""} FAILED`);
|
console.error(`${failed.size} test${failed.size !== 1 ? "s" : ""} FAILED`);
|
||||||
Array.from(failed).forEach(([{ lang, type }, err]) =>
|
_.sortBy(Array.from(failed), [
|
||||||
|
"lang",
|
||||||
|
"type",
|
||||||
|
]).forEach(([{ lang, type }, err]) =>
|
||||||
console.error(` - ${lang}/${type} (${err})`)
|
console.error(` - ${lang}/${type} (${err})`)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,6 @@
|
||||||
"dev": "run-p backend-dev frontend-dev system-dev server-dev",
|
"dev": "run-p backend-dev frontend-dev system-dev server-dev",
|
||||||
"lsp-repl": "node backend/out/lsp-repl.js",
|
"lsp-repl": "node backend/out/lsp-repl.js",
|
||||||
"sandbox": "node backend/out/sandbox.js",
|
"sandbox": "node backend/out/sandbox.js",
|
||||||
"test": "node backend/out/test-runner.js"
|
"test": "bash -c 'time node backend/out/test-runner.js'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ yarn
|
||||||
|
|
||||||
# Handy utilities
|
# Handy utilities
|
||||||
apt-file
|
apt-file
|
||||||
|
bbe
|
||||||
bsdmainutils
|
bsdmainutils
|
||||||
curl
|
curl
|
||||||
emacs-nox
|
emacs-nox
|
||||||
|
|
Loading…
Reference in New Issue