depot/third_party/nixpkgs/pkgs/development/libraries/languagemachines/test.nix
Default email 8ac5e011d6 Project import generated by Copybara.
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
2020-04-24 19:36:52 -04:00

25 lines
664 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"
''