nixpkgs/pkgs/development/libraries/languagemachines/test.nix
Shamrock Lee fecc5d7bff treewide: pkgs/**.nix: remove trailing whitespaces
Manually remove trailing white spaces
in `pkgs/**.nix` with the help of an editor

Auto-generated nix expressions containing trailing whitespaces:

*   pkgs/development/haskell-modules/hackage-packages.nix
    *   See issue https://github.com/NixOS/cabal2nix/issues/208
*   pkgs/**/eggs.nix
    *   I don't know how they are generated,
        but they seems to be Python-related.
2021-10-04 02:13:08 +08:00

25 lines
662 B
Nix

{ runCommand
, languageMachines
}:
runCommand "frog-test" {} ''
${languageMachines.frog}/bin/frog >$out <<EOF
Dit is een test
EOF
echo "Frog output:"
cat $out
expected () {
echo "Test expectation failed: $@"
exit 1
}
lines="$(wc -l $out | awk '{print $1}')"
test 5 = $lines || expected "Five lines of output"
grep "is" $out | grep "zijn" >/dev/null || expected "Stemming works"
grep "een" $out | grep "onbep" >/dev/null || expected "Tagging works"
deps="$(echo $(awk 'BEGIN { FS = "\t*" } ; {print $1 " -> " $9 "; "}' <$out))"
test "1 -> 2; 2 -> 0; 3 -> 4; 4 -> 2; -> ;" = "$deps" || expected "Dependency parsing works"
''