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 | |
parent | f25d48180af90638001104a61d6d10b22e4ecb28 (diff) |
cue: test in tests.cue-validation
-rw-r--r-- | pkgs/test/cue/default.nix | 24 | ||||
-rw-r--r-- | pkgs/test/default.nix | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/pkgs/test/cue/default.nix b/pkgs/test/cue/default.nix new file mode 100644 index 000000000000..2cc8bf34bb04 --- /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 +'' diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix index 3a39d247c8fe..e72afbb39980 100644 --- a/pkgs/test/default.nix +++ b/pkgs/test/default.nix @@ -77,6 +77,8 @@ with pkgs; dhall = callPackage ./dhall { }; + cue-validation = callPackage ./cue {}; + coq = callPackage ./coq {}; makeWrapper = callPackage ./make-wrapper { }; |