piston/runtimes/ruby.nix

57 lines
1.2 KiB
Nix
Raw Normal View History

2022-02-01 03:35:06 +01:00
{pkgs, piston, ...}:
let
2022-02-04 03:33:40 +01:00
pkg = pkgs.ruby_3_1;
2022-02-01 03:35:06 +01:00
in piston.mkRuntime {
language = "ruby";
version = pkg.version;
aliases = [
"ruby3"
"rb"
];
run = ''
${pkg}/bin/ruby "$@"
'';
# Run the following command to test the package:
# $ ./piston test ruby
tests = [
# standard output test
(piston.mkTest {
files = {
"test.rb" = ''
puts("OK");
'';
};
args = [];
stdin = "";
packages = [];
main = "test.rb";
})
# args test
(piston.mkTest {
files = {
"test.rb" = ''
puts $*;
'';
};
args = ["OK"];
stdin = "";
packages = [];
main = "test.rb";
})
# stdin test
(piston.mkTest {
files = {
"test.rb" = ''
print Kernel.gets;
'';
};
args = [];
stdin = "OK";
packages = [];
main = "test.rb";
})
];
}