cue: test in tests.cue-validation

This commit is contained in:
Jörg Thalheim 2022-12-08 22:19:23 +01:00
parent f25d48180a
commit 09dcdf4e4e
2 changed files with 26 additions and 0 deletions

24
pkgs/test/cue/default.nix Normal file
View File

@ -0,0 +1,24 @@
{ writeCueValidator, runCommand, writeText, ... }:
let
validator = writeCueValidator
(writeText "schema.cue" ''
#Def1: {
field1: string
}
'')
{ document = "#Def1"; };
in runCommand "cue-validation" {} ''
cat > valid.json <<EOF
{ "field1": "abc" }
EOF
cat > invalid.json <<EOF
{ "field2": "abc" }
EOF
${validator} valid.json
if ${validator} invalid.json; then
echo "this example should fail"
exit 1
fi
touch $out
''

View File

@ -77,6 +77,8 @@ with pkgs;
dhall = callPackage ./dhall { };
cue-validation = callPackage ./cue {};
coq = callPackage ./coq {};
makeWrapper = callPackage ./make-wrapper { };