diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2022-12-08 22:19:23 +0100 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2022-12-08 22:19:23 +0100 |
commit | 09dcdf4e4e684bebb6d1ee267d0be5d1613ff586 (patch) | |
tree | 200a6eba16aa4598ad84bc69952267e5a0798360 /pkgs/test/cue | |
parent | f25d48180af90638001104a61d6d10b22e4ecb28 (diff) |
cue: test in tests.cue-validation
Diffstat (limited to 'pkgs/test/cue')
-rw-r--r-- | pkgs/test/cue/default.nix | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pkgs/test/cue/default.nix b/pkgs/test/cue/default.nix new file mode 100644 index 0000000000000..2cc8bf34bb043 --- /dev/null +++ b/pkgs/test/cue/default.nix @@ -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 +'' |