mirror of
https://github.com/engineer-man/piston.git
synced 2025-06-09 03:26:27 +02:00
add piston nix pkg for brainfuck
This commit is contained in:
parent
16e4f08dfa
commit
96ffdb63dd
7 changed files with 56 additions and 36 deletions
55
runtimes/brainfuck.nix
Normal file
55
runtimes/brainfuck.nix
Normal file
|
@ -0,0 +1,55 @@
|
|||
{pkgs, piston, ...}:
|
||||
let
|
||||
# All other BF packages are either marked as broken in nix-pkgs
|
||||
# or have missing functionality. Yabi isn't perfect either.
|
||||
pkg = pkgs.haskellPackages.yabi;
|
||||
in piston.mkRuntime {
|
||||
language = "brainfuck";
|
||||
version = pkg.version;
|
||||
|
||||
aliases = [
|
||||
"bf"
|
||||
"yabi"
|
||||
];
|
||||
|
||||
run = ''
|
||||
# Yabi produces messages when parsing the BF file that are sent to stderr
|
||||
# Yabi will also break when trying to take more input at EOF
|
||||
${pkg}/bin/yabi "$1" 2> /dev/null
|
||||
'';
|
||||
|
||||
tests = [
|
||||
# stdout test
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.bf" = ''-[--->+<]>------.----.'';
|
||||
};
|
||||
args = [];
|
||||
stdin = "";
|
||||
packages = [];
|
||||
main = "test.bf";
|
||||
})
|
||||
|
||||
# stdin test
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.bf" = '',.,.'';
|
||||
};
|
||||
args = [];
|
||||
stdin = "OK";
|
||||
packages = [];
|
||||
main = "test.bf";
|
||||
})
|
||||
|
||||
# bf doesn't take args test
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.bf" = ''-[--->+<]>------.----.'';
|
||||
};
|
||||
args = ["OK"];
|
||||
stdin = "";
|
||||
packages = [];
|
||||
main = "test.bf";
|
||||
})
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue