summaryrefslogtreecommitdiff
path: root/dhall/tests/import
diff options
context:
space:
mode:
authorNadrieril2020-03-01 16:37:10 +0000
committerNadrieril2020-03-05 15:58:54 +0000
commit24ff14dc98b83ddc12239a0eae4852c9cd87d41f (patch)
tree494279e9ae81be144d7eb3834e6080a7819aea47 /dhall/tests/import
parente277fb2f7316fef5c20e7c485eeba1f14328d621 (diff)
Add a lot of import tests
Diffstat (limited to 'dhall/tests/import')
-rw-r--r--dhall/tests/import/data/cycle.dhall1
-rw-r--r--dhall/tests/import/data/doesNotTypecheck.dhall1
-rw-r--r--dhall/tests/import/data/example.txt1
-rw-r--r--dhall/tests/import/data/fieldOrder/1.dhall1
-rw-r--r--dhall/tests/import/data/fieldOrder/2.dhall1
-rw-r--r--dhall/tests/import/data/importBoundary.dhall3
-rw-r--r--dhall/tests/import/data/nested.dhall1
-rw-r--r--dhall/tests/import/data/referentiallyOpaque.dhall18
-rw-r--r--dhall/tests/import/data/simple.dhall1
-rw-r--r--dhall/tests/import/data/simpleLocation.dhall1
-rw-r--r--dhall/tests/import/failure/unit/EnvUnset.dhall1
-rw-r--r--dhall/tests/import/failure/unit/EnvUnsetAsText.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeChain1A.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeChain1B.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeChain2A.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeChain2B.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeEnvA.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeEnvB.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeHashMismatchA.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeHashMismatchB.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeImportErrorA.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeImportErrorB.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeNestedImportErrorA.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeNestedImportErrorB.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeNoError1A.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeNoError1B.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeNoError2A.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeNoError2B.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeNoError3A.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeNoError3B.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeParseErrorA.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeParseErrorB.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeSubExprA.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeSubExprB.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeTypeErrorA.dhall1
-rw-r--r--dhall/tests/import/success/unit/AlternativeTypeErrorB.dhall1
-rw-r--r--dhall/tests/import/success/unit/AsTextA.dhall1
-rw-r--r--dhall/tests/import/success/unit/AsTextB.dhall3
-rw-r--r--dhall/tests/import/success/unit/EnvSetA.dhall1
-rw-r--r--dhall/tests/import/success/unit/EnvSetAsTextA.dhall1
-rw-r--r--dhall/tests/import/success/unit/EnvSetAsTextB.dhall1
-rw-r--r--dhall/tests/import/success/unit/EnvSetB.dhall1
-rw-r--r--dhall/tests/import/success/unit/NormalizeA.dhall1
-rw-r--r--dhall/tests/import/success/unit/NormalizeB.dhall1
-rw-r--r--dhall/tests/import/success/unit/SimpleA.dhall1
-rw-r--r--dhall/tests/import/success/unit/SimpleB.dhall1
-rw-r--r--dhall/tests/import/success/unit/SimpleRemoteA.dhall1
-rw-r--r--dhall/tests/import/success/unit/SimpleRemoteB.dhall1
48 files changed, 69 insertions, 0 deletions
diff --git a/dhall/tests/import/data/cycle.dhall b/dhall/tests/import/data/cycle.dhall
new file mode 100644
index 0000000..c370a8d
--- /dev/null
+++ b/dhall/tests/import/data/cycle.dhall
@@ -0,0 +1 @@
+../failure/cycle.dhall
diff --git a/dhall/tests/import/data/doesNotTypecheck.dhall b/dhall/tests/import/data/doesNotTypecheck.dhall
new file mode 100644
index 0000000..b748e2d
--- /dev/null
+++ b/dhall/tests/import/data/doesNotTypecheck.dhall
@@ -0,0 +1 @@
+0 0
diff --git a/dhall/tests/import/data/example.txt b/dhall/tests/import/data/example.txt
new file mode 100644
index 0000000..af5626b
--- /dev/null
+++ b/dhall/tests/import/data/example.txt
@@ -0,0 +1 @@
+Hello, world!
diff --git a/dhall/tests/import/data/fieldOrder/1.dhall b/dhall/tests/import/data/fieldOrder/1.dhall
new file mode 100644
index 0000000..797e071
--- /dev/null
+++ b/dhall/tests/import/data/fieldOrder/1.dhall
@@ -0,0 +1 @@
+{ foo = 1, bar = True }
diff --git a/dhall/tests/import/data/fieldOrder/2.dhall b/dhall/tests/import/data/fieldOrder/2.dhall
new file mode 100644
index 0000000..c16b568
--- /dev/null
+++ b/dhall/tests/import/data/fieldOrder/2.dhall
@@ -0,0 +1 @@
+{ bar = True, foo = 1 }
diff --git a/dhall/tests/import/data/importBoundary.dhall b/dhall/tests/import/data/importBoundary.dhall
new file mode 100644
index 0000000..e6f1074
--- /dev/null
+++ b/dhall/tests/import/data/importBoundary.dhall
@@ -0,0 +1,3 @@
+-- This file contains a free variable. This should be a type error, even if the variable
+-- is in scope in the importing expression
+x
diff --git a/dhall/tests/import/data/nested.dhall b/dhall/tests/import/data/nested.dhall
new file mode 100644
index 0000000..bf88f65
--- /dev/null
+++ b/dhall/tests/import/data/nested.dhall
@@ -0,0 +1 @@
+{ x = ./simple.dhall sha256:15f52ecf91c94c1baac02d5a4964b2ed8fa401641a2c8a95e8306ec7c1e3b8d2 }
diff --git a/dhall/tests/import/data/referentiallyOpaque.dhall b/dhall/tests/import/data/referentiallyOpaque.dhall
new file mode 100644
index 0000000..ff33765
--- /dev/null
+++ b/dhall/tests/import/data/referentiallyOpaque.dhall
@@ -0,0 +1,18 @@
+{- This is a "referentially opaque" import (i.e. an import that is not
+ globally addressable), which cannot be imported by a "referentially
+ transparent" import (i.e. an import that is globally addressable).
+
+ This test file is used in a failing test to verify that referentially
+ transparent imports cannot import referentially opaque imports. In the test
+ suite this file is actually imported via its GitHub URL (not its local file
+ path), so it plays the role of the referentially transparent import. Then,
+ this file attempts to import a referentially opaque import (an environment
+ variable in this case) to verify that the import fails.
+
+ For this test file we need to select a referentially opaque import that
+ would succeed if imported on its own, so that a non-compliant implementation
+ doesn't fail this test for the wrong reason (i.e. due to the import not
+ being present). We thus use the `DHALL_TEST_VAR` environment variable, that
+ is expected to be set when running import tests.
+-}
+env:DHALL_TEST_VAR as Text
diff --git a/dhall/tests/import/data/simple.dhall b/dhall/tests/import/data/simple.dhall
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/dhall/tests/import/data/simple.dhall
@@ -0,0 +1 @@
+3
diff --git a/dhall/tests/import/data/simpleLocation.dhall b/dhall/tests/import/data/simpleLocation.dhall
new file mode 100644
index 0000000..1d3e43b
--- /dev/null
+++ b/dhall/tests/import/data/simpleLocation.dhall
@@ -0,0 +1 @@
+./simple.dhall as Location
diff --git a/dhall/tests/import/failure/unit/EnvUnset.dhall b/dhall/tests/import/failure/unit/EnvUnset.dhall
new file mode 100644
index 0000000..af77cce
--- /dev/null
+++ b/dhall/tests/import/failure/unit/EnvUnset.dhall
@@ -0,0 +1 @@
+env:DHALL_TEST_UNSET
diff --git a/dhall/tests/import/failure/unit/EnvUnsetAsText.dhall b/dhall/tests/import/failure/unit/EnvUnsetAsText.dhall
new file mode 100644
index 0000000..9a9db6d
--- /dev/null
+++ b/dhall/tests/import/failure/unit/EnvUnsetAsText.dhall
@@ -0,0 +1 @@
+env:DHALL_TEST_UNSET as Text
diff --git a/dhall/tests/import/success/unit/AlternativeChain1A.dhall b/dhall/tests/import/success/unit/AlternativeChain1A.dhall
new file mode 100644
index 0000000..15fbf4b
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeChain1A.dhall
@@ -0,0 +1 @@
+missing ? missing ? 42
diff --git a/dhall/tests/import/success/unit/AlternativeChain1B.dhall b/dhall/tests/import/success/unit/AlternativeChain1B.dhall
new file mode 100644
index 0000000..d81cc07
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeChain1B.dhall
@@ -0,0 +1 @@
+42
diff --git a/dhall/tests/import/success/unit/AlternativeChain2A.dhall b/dhall/tests/import/success/unit/AlternativeChain2A.dhall
new file mode 100644
index 0000000..f3ba4b5
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeChain2A.dhall
@@ -0,0 +1 @@
+missing ? 42 ? 10
diff --git a/dhall/tests/import/success/unit/AlternativeChain2B.dhall b/dhall/tests/import/success/unit/AlternativeChain2B.dhall
new file mode 100644
index 0000000..d81cc07
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeChain2B.dhall
@@ -0,0 +1 @@
+42
diff --git a/dhall/tests/import/success/unit/AlternativeEnvA.dhall b/dhall/tests/import/success/unit/AlternativeEnvA.dhall
new file mode 100644
index 0000000..1807534
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeEnvA.dhall
@@ -0,0 +1 @@
+env:DHALL_TEST_UNSET ? 42
diff --git a/dhall/tests/import/success/unit/AlternativeEnvB.dhall b/dhall/tests/import/success/unit/AlternativeEnvB.dhall
new file mode 100644
index 0000000..d81cc07
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeEnvB.dhall
@@ -0,0 +1 @@
+42
diff --git a/dhall/tests/import/success/unit/AlternativeHashMismatchA.dhall b/dhall/tests/import/success/unit/AlternativeHashMismatchA.dhall
new file mode 100644
index 0000000..8f7fb02
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeHashMismatchA.dhall
@@ -0,0 +1 @@
+../../data/simple.dhall sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ? 42
diff --git a/dhall/tests/import/success/unit/AlternativeHashMismatchB.dhall b/dhall/tests/import/success/unit/AlternativeHashMismatchB.dhall
new file mode 100644
index 0000000..d81cc07
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeHashMismatchB.dhall
@@ -0,0 +1 @@
+42
diff --git a/dhall/tests/import/success/unit/AlternativeImportErrorA.dhall b/dhall/tests/import/success/unit/AlternativeImportErrorA.dhall
new file mode 100644
index 0000000..9ecc640
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeImportErrorA.dhall
@@ -0,0 +1 @@
+missing ? 42
diff --git a/dhall/tests/import/success/unit/AlternativeImportErrorB.dhall b/dhall/tests/import/success/unit/AlternativeImportErrorB.dhall
new file mode 100644
index 0000000..d81cc07
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeImportErrorB.dhall
@@ -0,0 +1 @@
+42
diff --git a/dhall/tests/import/success/unit/AlternativeNestedImportErrorA.dhall b/dhall/tests/import/success/unit/AlternativeNestedImportErrorA.dhall
new file mode 100644
index 0000000..d681287
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeNestedImportErrorA.dhall
@@ -0,0 +1 @@
+../../failure/missing.dhall ? 42
diff --git a/dhall/tests/import/success/unit/AlternativeNestedImportErrorB.dhall b/dhall/tests/import/success/unit/AlternativeNestedImportErrorB.dhall
new file mode 100644
index 0000000..d81cc07
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeNestedImportErrorB.dhall
@@ -0,0 +1 @@
+42
diff --git a/dhall/tests/import/success/unit/AlternativeNoError1A.dhall b/dhall/tests/import/success/unit/AlternativeNoError1A.dhall
new file mode 100644
index 0000000..f7c9caf
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeNoError1A.dhall
@@ -0,0 +1 @@
+42 ? 10
diff --git a/dhall/tests/import/success/unit/AlternativeNoError1B.dhall b/dhall/tests/import/success/unit/AlternativeNoError1B.dhall
new file mode 100644
index 0000000..d81cc07
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeNoError1B.dhall
@@ -0,0 +1 @@
+42
diff --git a/dhall/tests/import/success/unit/AlternativeNoError2A.dhall b/dhall/tests/import/success/unit/AlternativeNoError2A.dhall
new file mode 100644
index 0000000..877afd2
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeNoError2A.dhall
@@ -0,0 +1 @@
+42 ? missing
diff --git a/dhall/tests/import/success/unit/AlternativeNoError2B.dhall b/dhall/tests/import/success/unit/AlternativeNoError2B.dhall
new file mode 100644
index 0000000..d81cc07
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeNoError2B.dhall
@@ -0,0 +1 @@
+42
diff --git a/dhall/tests/import/success/unit/AlternativeNoError3A.dhall b/dhall/tests/import/success/unit/AlternativeNoError3A.dhall
new file mode 100644
index 0000000..91bcda2
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeNoError3A.dhall
@@ -0,0 +1 @@
+env:DHALL_TEST_VAR ? 10
diff --git a/dhall/tests/import/success/unit/AlternativeNoError3B.dhall b/dhall/tests/import/success/unit/AlternativeNoError3B.dhall
new file mode 100644
index 0000000..d81cc07
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeNoError3B.dhall
@@ -0,0 +1 @@
+42
diff --git a/dhall/tests/import/success/unit/AlternativeParseErrorA.dhall b/dhall/tests/import/success/unit/AlternativeParseErrorA.dhall
new file mode 100644
index 0000000..d427c5d
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeParseErrorA.dhall
@@ -0,0 +1 @@
+../../data/example.txt ? 42
diff --git a/dhall/tests/import/success/unit/AlternativeParseErrorB.dhall b/dhall/tests/import/success/unit/AlternativeParseErrorB.dhall
new file mode 100644
index 0000000..d81cc07
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeParseErrorB.dhall
@@ -0,0 +1 @@
+42
diff --git a/dhall/tests/import/success/unit/AlternativeSubExprA.dhall b/dhall/tests/import/success/unit/AlternativeSubExprA.dhall
new file mode 100644
index 0000000..2c13f4b
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeSubExprA.dhall
@@ -0,0 +1 @@
+missing + 10 ? 42
diff --git a/dhall/tests/import/success/unit/AlternativeSubExprB.dhall b/dhall/tests/import/success/unit/AlternativeSubExprB.dhall
new file mode 100644
index 0000000..d81cc07
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeSubExprB.dhall
@@ -0,0 +1 @@
+42
diff --git a/dhall/tests/import/success/unit/AlternativeTypeErrorA.dhall b/dhall/tests/import/success/unit/AlternativeTypeErrorA.dhall
new file mode 100644
index 0000000..24ae717
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeTypeErrorA.dhall
@@ -0,0 +1 @@
+../../data/doesNotTypecheck.dhall ? 42
diff --git a/dhall/tests/import/success/unit/AlternativeTypeErrorB.dhall b/dhall/tests/import/success/unit/AlternativeTypeErrorB.dhall
new file mode 100644
index 0000000..d81cc07
--- /dev/null
+++ b/dhall/tests/import/success/unit/AlternativeTypeErrorB.dhall
@@ -0,0 +1 @@
+42
diff --git a/dhall/tests/import/success/unit/AsTextA.dhall b/dhall/tests/import/success/unit/AsTextA.dhall
new file mode 100644
index 0000000..9edb0ed
--- /dev/null
+++ b/dhall/tests/import/success/unit/AsTextA.dhall
@@ -0,0 +1 @@
+../../data/example.txt as Text
diff --git a/dhall/tests/import/success/unit/AsTextB.dhall b/dhall/tests/import/success/unit/AsTextB.dhall
new file mode 100644
index 0000000..1997a89
--- /dev/null
+++ b/dhall/tests/import/success/unit/AsTextB.dhall
@@ -0,0 +1,3 @@
+''
+Hello, world!
+''
diff --git a/dhall/tests/import/success/unit/EnvSetA.dhall b/dhall/tests/import/success/unit/EnvSetA.dhall
new file mode 100644
index 0000000..f851f2a
--- /dev/null
+++ b/dhall/tests/import/success/unit/EnvSetA.dhall
@@ -0,0 +1 @@
+env:DHALL_TEST_VAR
diff --git a/dhall/tests/import/success/unit/EnvSetAsTextA.dhall b/dhall/tests/import/success/unit/EnvSetAsTextA.dhall
new file mode 100644
index 0000000..139b241
--- /dev/null
+++ b/dhall/tests/import/success/unit/EnvSetAsTextA.dhall
@@ -0,0 +1 @@
+env:DHALL_TEST_VAR as Text
diff --git a/dhall/tests/import/success/unit/EnvSetAsTextB.dhall b/dhall/tests/import/success/unit/EnvSetAsTextB.dhall
new file mode 100644
index 0000000..192548e
--- /dev/null
+++ b/dhall/tests/import/success/unit/EnvSetAsTextB.dhall
@@ -0,0 +1 @@
+"42"
diff --git a/dhall/tests/import/success/unit/EnvSetB.dhall b/dhall/tests/import/success/unit/EnvSetB.dhall
new file mode 100644
index 0000000..d81cc07
--- /dev/null
+++ b/dhall/tests/import/success/unit/EnvSetB.dhall
@@ -0,0 +1 @@
+42
diff --git a/dhall/tests/import/success/unit/NormalizeA.dhall b/dhall/tests/import/success/unit/NormalizeA.dhall
new file mode 100644
index 0000000..2f89d08
--- /dev/null
+++ b/dhall/tests/import/success/unit/NormalizeA.dhall
@@ -0,0 +1 @@
+../../../../../dhall-lang/tests/normalization/success/unit/OperatorPlusOneAndOneA.dhall
diff --git a/dhall/tests/import/success/unit/NormalizeB.dhall b/dhall/tests/import/success/unit/NormalizeB.dhall
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/dhall/tests/import/success/unit/NormalizeB.dhall
@@ -0,0 +1 @@
+2
diff --git a/dhall/tests/import/success/unit/SimpleA.dhall b/dhall/tests/import/success/unit/SimpleA.dhall
new file mode 100644
index 0000000..035ee8b
--- /dev/null
+++ b/dhall/tests/import/success/unit/SimpleA.dhall
@@ -0,0 +1 @@
+../../data/simple.dhall
diff --git a/dhall/tests/import/success/unit/SimpleB.dhall b/dhall/tests/import/success/unit/SimpleB.dhall
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/dhall/tests/import/success/unit/SimpleB.dhall
@@ -0,0 +1 @@
+3
diff --git a/dhall/tests/import/success/unit/SimpleRemoteA.dhall b/dhall/tests/import/success/unit/SimpleRemoteA.dhall
new file mode 100644
index 0000000..30e0a79
--- /dev/null
+++ b/dhall/tests/import/success/unit/SimpleRemoteA.dhall
@@ -0,0 +1 @@
+https://raw.githubusercontent.com/dhall-lang/dhall-lang/0b983b92aa2222dc3e292c20550ee37dea3f41df/tests/import/data/simple.dhall
diff --git a/dhall/tests/import/success/unit/SimpleRemoteB.dhall b/dhall/tests/import/success/unit/SimpleRemoteB.dhall
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/dhall/tests/import/success/unit/SimpleRemoteB.dhall
@@ -0,0 +1 @@
+3