summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNadrieril2020-02-29 22:03:46 +0000
committerNadrieril2020-03-05 15:58:54 +0000
commit60d202471ed5013d1ab607a4c34b82448d708261 (patch)
tree0da085d9b468d6474c587e057cfd55334135c6f6
parentd0a1416b4f2f8138a0751553aac0f34be82e579a (diff)
Add a bunch of `as Location` unit tests
Diffstat (limited to '')
-rw-r--r--dhall/build.rs2
-rw-r--r--dhall/tests/import/success/unit/asLocation/AbsoluteA.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/AbsoluteB.dhall2
-rw-r--r--dhall/tests/import/success/unit/asLocation/Canonicalize1A.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/Canonicalize1B.dhall2
-rw-r--r--dhall/tests/import/success/unit/asLocation/Canonicalize2A.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/Canonicalize2B.dhall2
-rw-r--r--dhall/tests/import/success/unit/asLocation/Canonicalize3A.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/Canonicalize3B.dhall2
-rw-r--r--dhall/tests/import/success/unit/asLocation/Canonicalize4A.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/Canonicalize4B.dhall2
-rw-r--r--dhall/tests/import/success/unit/asLocation/Canonicalize5A.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/Canonicalize5B.dhall2
-rw-r--r--dhall/tests/import/success/unit/asLocation/Chain1A.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/Chain1B.dhall2
-rw-r--r--dhall/tests/import/success/unit/asLocation/Chain2A.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/Chain2B.dhall2
-rw-r--r--dhall/tests/import/success/unit/asLocation/Chain3A.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/Chain3B.dhall2
-rw-r--r--dhall/tests/import/success/unit/asLocation/DontTryResolvingA.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/DontTryResolvingB.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/EnvA.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/EnvB.dhall2
-rw-r--r--dhall/tests/import/success/unit/asLocation/HashA.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/HashB.dhall2
-rw-r--r--dhall/tests/import/success/unit/asLocation/HomeA.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/HomeB.dhall2
-rw-r--r--dhall/tests/import/success/unit/asLocation/MissingA.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/MissingB.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/RelativeA.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/RelativeB.dhall2
-rw-r--r--dhall/tests/import/success/unit/asLocation/RemoteA.dhall1
-rw-r--r--dhall/tests/import/success/unit/asLocation/RemoteB.dhall2
-rw-r--r--dhall/tests/type-inference/success/CacheImportsA.dhall1
-rw-r--r--dhall/tests/type-inference/success/CacheImportsB.dhall1
-rw-r--r--tests_buffer2
36 files changed, 51 insertions, 1 deletions
diff --git a/dhall/build.rs b/dhall/build.rs
index 884a4cd..137ef02 100644
--- a/dhall/build.rs
+++ b/dhall/build.rs
@@ -321,6 +321,8 @@ fn generate_tests() -> std::io::Result<()> {
// Too slow, but also not all features implemented
// For now needs support for hashed imports
|| path == "prelude"
+ // TODO: imports
+ || path == "CacheImports"
}),
input_type: FileType::Text,
output_type: Some(FileType::Text),
diff --git a/dhall/tests/import/success/unit/asLocation/AbsoluteA.dhall b/dhall/tests/import/success/unit/asLocation/AbsoluteA.dhall
new file mode 100644
index 0000000..dcf45d1
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/AbsoluteA.dhall
@@ -0,0 +1 @@
+/absolute/import as Location
diff --git a/dhall/tests/import/success/unit/asLocation/AbsoluteB.dhall b/dhall/tests/import/success/unit/asLocation/AbsoluteB.dhall
new file mode 100644
index 0000000..1c1add7
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/AbsoluteB.dhall
@@ -0,0 +1,2 @@
+< Environment : Text | Remote : Text | Local : Text | Missing >.Local
+ "/absolute/import"
diff --git a/dhall/tests/import/success/unit/asLocation/Canonicalize1A.dhall b/dhall/tests/import/success/unit/asLocation/Canonicalize1A.dhall
new file mode 100644
index 0000000..e636ed1
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Canonicalize1A.dhall
@@ -0,0 +1 @@
+./foo/./bar/import.dhall as Location
diff --git a/dhall/tests/import/success/unit/asLocation/Canonicalize1B.dhall b/dhall/tests/import/success/unit/asLocation/Canonicalize1B.dhall
new file mode 100644
index 0000000..3a8a926
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Canonicalize1B.dhall
@@ -0,0 +1,2 @@
+< Environment : Text | Remote : Text | Local : Text | Missing >.Local
+ "./dhall/tests/import/success/unit/asLocation/foo/bar/import.dhall"
diff --git a/dhall/tests/import/success/unit/asLocation/Canonicalize2A.dhall b/dhall/tests/import/success/unit/asLocation/Canonicalize2A.dhall
new file mode 100644
index 0000000..c6ef89f
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Canonicalize2A.dhall
@@ -0,0 +1 @@
+./foo/baz/../bar/import.dhall as Location
diff --git a/dhall/tests/import/success/unit/asLocation/Canonicalize2B.dhall b/dhall/tests/import/success/unit/asLocation/Canonicalize2B.dhall
new file mode 100644
index 0000000..3a8a926
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Canonicalize2B.dhall
@@ -0,0 +1,2 @@
+< Environment : Text | Remote : Text | Local : Text | Missing >.Local
+ "./dhall/tests/import/success/unit/asLocation/foo/bar/import.dhall"
diff --git a/dhall/tests/import/success/unit/asLocation/Canonicalize3A.dhall b/dhall/tests/import/success/unit/asLocation/Canonicalize3A.dhall
new file mode 100644
index 0000000..e6be780
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Canonicalize3A.dhall
@@ -0,0 +1 @@
+./../bar/import.dhall as Location
diff --git a/dhall/tests/import/success/unit/asLocation/Canonicalize3B.dhall b/dhall/tests/import/success/unit/asLocation/Canonicalize3B.dhall
new file mode 100644
index 0000000..b223da6
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Canonicalize3B.dhall
@@ -0,0 +1,2 @@
+< Environment : Text | Remote : Text | Local : Text | Missing >.Local
+ "./dhall/tests/import/success/unit/bar/import.dhall"
diff --git a/dhall/tests/import/success/unit/asLocation/Canonicalize4A.dhall b/dhall/tests/import/success/unit/asLocation/Canonicalize4A.dhall
new file mode 100644
index 0000000..ffccd47
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Canonicalize4A.dhall
@@ -0,0 +1 @@
+../../bar/import.dhall as Location
diff --git a/dhall/tests/import/success/unit/asLocation/Canonicalize4B.dhall b/dhall/tests/import/success/unit/asLocation/Canonicalize4B.dhall
new file mode 100644
index 0000000..b6301f8
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Canonicalize4B.dhall
@@ -0,0 +1,2 @@
+< Environment : Text | Remote : Text | Local : Text | Missing >.Local
+ "./dhall/tests/import/success/bar/import.dhall"
diff --git a/dhall/tests/import/success/unit/asLocation/Canonicalize5A.dhall b/dhall/tests/import/success/unit/asLocation/Canonicalize5A.dhall
new file mode 100644
index 0000000..7e58f0b
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Canonicalize5A.dhall
@@ -0,0 +1 @@
+./foo/../../bar/import.dhall as Location
diff --git a/dhall/tests/import/success/unit/asLocation/Canonicalize5B.dhall b/dhall/tests/import/success/unit/asLocation/Canonicalize5B.dhall
new file mode 100644
index 0000000..b223da6
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Canonicalize5B.dhall
@@ -0,0 +1,2 @@
+< Environment : Text | Remote : Text | Local : Text | Missing >.Local
+ "./dhall/tests/import/success/unit/bar/import.dhall"
diff --git a/dhall/tests/import/success/unit/asLocation/Chain1A.dhall b/dhall/tests/import/success/unit/asLocation/Chain1A.dhall
new file mode 100644
index 0000000..7b20bc3
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Chain1A.dhall
@@ -0,0 +1 @@
+./RelativeA.dhall
diff --git a/dhall/tests/import/success/unit/asLocation/Chain1B.dhall b/dhall/tests/import/success/unit/asLocation/Chain1B.dhall
new file mode 100644
index 0000000..6aee0b5
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Chain1B.dhall
@@ -0,0 +1,2 @@
+< Environment : Text | Local : Text | Missing | Remote : Text >.Local
+ "./dhall/tests/import/success/unit/asLocation/some/import.dhall"
diff --git a/dhall/tests/import/success/unit/asLocation/Chain2A.dhall b/dhall/tests/import/success/unit/asLocation/Chain2A.dhall
new file mode 100644
index 0000000..cdbd10d
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Chain2A.dhall
@@ -0,0 +1 @@
+./Canonicalize4A.dhall
diff --git a/dhall/tests/import/success/unit/asLocation/Chain2B.dhall b/dhall/tests/import/success/unit/asLocation/Chain2B.dhall
new file mode 100644
index 0000000..6aba54e
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Chain2B.dhall
@@ -0,0 +1,2 @@
+< Environment : Text | Local : Text | Missing | Remote : Text >.Local
+ "./dhall/tests/import/success/bar/import.dhall"
diff --git a/dhall/tests/import/success/unit/asLocation/Chain3A.dhall b/dhall/tests/import/success/unit/asLocation/Chain3A.dhall
new file mode 100644
index 0000000..b44f0d4
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Chain3A.dhall
@@ -0,0 +1 @@
+./../asLocation/Canonicalize4A.dhall
diff --git a/dhall/tests/import/success/unit/asLocation/Chain3B.dhall b/dhall/tests/import/success/unit/asLocation/Chain3B.dhall
new file mode 100644
index 0000000..6aba54e
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/Chain3B.dhall
@@ -0,0 +1,2 @@
+< Environment : Text | Local : Text | Missing | Remote : Text >.Local
+ "./dhall/tests/import/success/bar/import.dhall"
diff --git a/dhall/tests/import/success/unit/asLocation/DontTryResolvingA.dhall b/dhall/tests/import/success/unit/asLocation/DontTryResolvingA.dhall
new file mode 100644
index 0000000..e70016c
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/DontTryResolvingA.dhall
@@ -0,0 +1 @@
+(missing as Location) ? 42 -- `missing` fails as an import, but definitely resolves as Location
diff --git a/dhall/tests/import/success/unit/asLocation/DontTryResolvingB.dhall b/dhall/tests/import/success/unit/asLocation/DontTryResolvingB.dhall
new file mode 100644
index 0000000..dd5e798
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/DontTryResolvingB.dhall
@@ -0,0 +1 @@
+< Environment : Text | Remote : Text | Local : Text | Missing >.Missing
diff --git a/dhall/tests/import/success/unit/asLocation/EnvA.dhall b/dhall/tests/import/success/unit/asLocation/EnvA.dhall
new file mode 100644
index 0000000..eb4b4a6
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/EnvA.dhall
@@ -0,0 +1 @@
+env:HOME as Location
diff --git a/dhall/tests/import/success/unit/asLocation/EnvB.dhall b/dhall/tests/import/success/unit/asLocation/EnvB.dhall
new file mode 100644
index 0000000..4947caa
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/EnvB.dhall
@@ -0,0 +1,2 @@
+< Environment : Text | Remote : Text | Local : Text | Missing >.Environment
+ "HOME"
diff --git a/dhall/tests/import/success/unit/asLocation/HashA.dhall b/dhall/tests/import/success/unit/asLocation/HashA.dhall
new file mode 100644
index 0000000..79f4fda
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/HashA.dhall
@@ -0,0 +1 @@
+./some/import.dhall sha256:f9340badf94a684e652e0a384f64363293d8b632d971f3453f7ee22f10ab6e75 as Location
diff --git a/dhall/tests/import/success/unit/asLocation/HashB.dhall b/dhall/tests/import/success/unit/asLocation/HashB.dhall
new file mode 100644
index 0000000..6aee0b5
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/HashB.dhall
@@ -0,0 +1,2 @@
+< Environment : Text | Local : Text | Missing | Remote : Text >.Local
+ "./dhall/tests/import/success/unit/asLocation/some/import.dhall"
diff --git a/dhall/tests/import/success/unit/asLocation/HomeA.dhall b/dhall/tests/import/success/unit/asLocation/HomeA.dhall
new file mode 100644
index 0000000..18cc2cd
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/HomeA.dhall
@@ -0,0 +1 @@
+~/some/import.dhall as Location
diff --git a/dhall/tests/import/success/unit/asLocation/HomeB.dhall b/dhall/tests/import/success/unit/asLocation/HomeB.dhall
new file mode 100644
index 0000000..8b4f0fd
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/HomeB.dhall
@@ -0,0 +1,2 @@
+< Environment : Text | Remote : Text | Local : Text | Missing >.Local
+ "~/some/import.dhall"
diff --git a/dhall/tests/import/success/unit/asLocation/MissingA.dhall b/dhall/tests/import/success/unit/asLocation/MissingA.dhall
new file mode 100644
index 0000000..e06a30b
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/MissingA.dhall
@@ -0,0 +1 @@
+missing as Location
diff --git a/dhall/tests/import/success/unit/asLocation/MissingB.dhall b/dhall/tests/import/success/unit/asLocation/MissingB.dhall
new file mode 100644
index 0000000..dd5e798
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/MissingB.dhall
@@ -0,0 +1 @@
+< Environment : Text | Remote : Text | Local : Text | Missing >.Missing
diff --git a/dhall/tests/import/success/unit/asLocation/RelativeA.dhall b/dhall/tests/import/success/unit/asLocation/RelativeA.dhall
new file mode 100644
index 0000000..b514f79
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/RelativeA.dhall
@@ -0,0 +1 @@
+./some/import.dhall as Location
diff --git a/dhall/tests/import/success/unit/asLocation/RelativeB.dhall b/dhall/tests/import/success/unit/asLocation/RelativeB.dhall
new file mode 100644
index 0000000..b3bd255
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/RelativeB.dhall
@@ -0,0 +1,2 @@
+< Environment : Text | Remote : Text | Local : Text | Missing >.Local
+ "./dhall/tests/import/success/unit/asLocation/some/import.dhall"
diff --git a/dhall/tests/import/success/unit/asLocation/RemoteA.dhall b/dhall/tests/import/success/unit/asLocation/RemoteA.dhall
new file mode 100644
index 0000000..e0be314
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/RemoteA.dhall
@@ -0,0 +1 @@
+https://prelude.dhall-lang.org/package.dhall as Location
diff --git a/dhall/tests/import/success/unit/asLocation/RemoteB.dhall b/dhall/tests/import/success/unit/asLocation/RemoteB.dhall
new file mode 100644
index 0000000..8ab6366
--- /dev/null
+++ b/dhall/tests/import/success/unit/asLocation/RemoteB.dhall
@@ -0,0 +1,2 @@
+< Environment : Text | Remote : Text | Local : Text | Missing >.Remote
+ "https://prelude.dhall-lang.org/package.dhall"
diff --git a/dhall/tests/type-inference/success/CacheImportsA.dhall b/dhall/tests/type-inference/success/CacheImportsA.dhall
new file mode 100644
index 0000000..3bd2bc1
--- /dev/null
+++ b/dhall/tests/type-inference/success/CacheImportsA.dhall
@@ -0,0 +1 @@
+let _ = assert : https://csrng.net/csrng/csrng.php?min=0&max=1000 as Text === https://csrng.net/csrng/csrng.php?min=0&max=1000 as Text in 0
diff --git a/dhall/tests/type-inference/success/CacheImportsB.dhall b/dhall/tests/type-inference/success/CacheImportsB.dhall
new file mode 100644
index 0000000..2f184a4
--- /dev/null
+++ b/dhall/tests/type-inference/success/CacheImportsB.dhall
@@ -0,0 +1 @@
+Natural
diff --git a/tests_buffer b/tests_buffer
index 6f6e67e..d7c8e84 100644
--- a/tests_buffer
+++ b/tests_buffer
@@ -19,7 +19,7 @@ failure/
normalization:
variables across import boundaries
-typecheck:
+type-inference:
something that involves destructuring a recordtype after merge
add some of the more complicated Prelude tests back, like List/enumerate
success/