diff --git a/pkgs/development/interpreters/spidermonkey/common.nix b/pkgs/development/interpreters/spidermonkey/common.nix index ecb1b71f93fd..69dc637b2340 100644 --- a/pkgs/development/interpreters/spidermonkey/common.nix +++ b/pkgs/development/interpreters/spidermonkey/common.nix @@ -1,6 +1,7 @@ { version, hash }: -{ lib +{ callPackage +, lib , stdenv , fetchurl , fetchpatch @@ -28,7 +29,7 @@ , zlib }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: rec { pname = "spidermonkey"; inherit version; @@ -160,6 +161,10 @@ stdenv.mkDerivation rec { ln -s $out/bin/js${lib.versions.major version} $out/bin/js ''; + passthru.tests.run = callPackage ./test.nix { + spidermonkey = finalAttrs.finalPackage; + }; + meta = with lib; { description = "Mozilla's JavaScript engine written in C/C++"; homepage = "https://spidermonkey.dev/"; @@ -167,4 +172,4 @@ stdenv.mkDerivation rec { maintainers = with maintainers; [ abbradar lostnet ]; platforms = platforms.linux; }; -} +}) diff --git a/pkgs/development/interpreters/spidermonkey/test.nix b/pkgs/development/interpreters/spidermonkey/test.nix new file mode 100644 index 000000000000..c3ef92bebfa8 --- /dev/null +++ b/pkgs/development/interpreters/spidermonkey/test.nix @@ -0,0 +1,10 @@ +{ runCommand, spidermonkey }: + +runCommand "spidermonkey-test-run" { + nativeBuildInputs = [ + spidermonkey + ]; +} '' + diff -U3 --color=auto <(js <(echo "console.log('Hello, world\!')")) <(echo 'Hello, world!') + touch $out +''