Repository: tweag/nickel
Pull request #992 (2022-12-14 11:10:03)

Automate adding `.ncl` file test cases
There are currently two integration test files where we run checks on a bunch of `.ncl` files in a given directory. Until now, these were manually maintained, meaning developers had to add the `.ncl` file and then remember to actually write the test case.

This PR automates the second step by using the [test-generator](https://github.com/frehberg/test-generator) crate. This crate provides a declarative macro which can build test cases from all file paths matching a given glob, which means we can very easily run the same test for every Nickel source file in a given directory.

This is then applied to the `pass.rs` suite of Nickel files we expect to run without error.

matthew-healy: > why is there blame but not missing field error, for example

Mostly because there are currently no examples which would use a missing field error right now, and I'm a big proponent of [YAGNI](https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it). :grin: 

As I said in the PR description, this could definitely be expanded on in the future, but I think what's here brings benefit now and can serve as a basis for further iteration (which I'm very much in favour of - I love the idea of a generic framework for annotating files with expected errors).

> Would that be easy to split this PR in two (automating passing tests vs examples)?

Very easy - I can just drop the last commit from here & open a new PR with just that. I'll do it just now, then we can merge the first two commits & continue the discussion about the examples on that PR.
matthew-healy: I dropped the `examples/` commit from this PR & opened #997 to further discuss that change.

Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 5d5fbae6..90ecf0ab 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -535,8 +535,8 @@ version = "0.1.22"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c"
 dependencies = [
- "quote",
- "syn",
+ "quote 1.0.18",
+ "syn 1.0.95",
 ]
 
 [[package]]
@@ -555,10 +555,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
 dependencies = [
  "convert_case",
- "proc-macro2",
- "quote",
+ "proc-macro2 1.0.39",
+ "quote 1.0.18",
  "rustc_version",
- "syn",
+ "syn 1.0.95",
 ]
 
 [[package]]
@@ -813,6 +813,12 @@ version = "0.26.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
 
+[[package]]
+name = "glob"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
+
 [[package]]
 name = "half"
 version = "1.8.2"
@@ -953,7 +959,7 @@ dependencies = [
  "string_cache",
  "term",
  "tiny-keccak",
- "unicode-xid",
+ "unicode-xid 0.2.3",
 ]
 
 [[package]]
@@ -1040,10 +1046,10 @@ checksum = "56a7d287fd2ac3f75b11f19a1c8a874a7d55744bd91f7a1b3e7cf87d4343c36d"
 dependencies = [
  "beef",
  "fnv",
- "proc-macro2",
- "quote",
+ "proc-macro2 1.0.39",
+ "quote 1.0.18",
  "regex-syntax",
- "syn",
+ "syn 1.0.95",
  "utf8-ranges",
 ]
 
@@ -1207,6 +1213,7 @@ dependencies = [
  "simple-counter",
  "structopt",
  "termimad",
+ "test-generator",
  "toml",
  "typed-arena 2.0.1",
  "void",
@@ -1471,9 +1478,9 @@ checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55"
 dependencies = [
  "pest",
  "pest_meta",
- "proc-macro2",
- "quote",
- "syn",
+ "proc-macro2 1.0.39",
+ "quote 1.0.18",
+ "syn 1.0.95",
 ]
 
 [[package]]
@@ -1619,9 +1626,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
 dependencies = [
  "proc-macro-error-attr",
- "proc-macro2",
- "quote",
- "syn",
+ "proc-macro2 1.0.39",
+ "quote 1.0.18",
+ "syn 1.0.95",
  "version_check",
 ]
 
@@ -1631,11 +1638,20 @@ version = "1.0.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
 dependencies = [
- "proc-macro2",
- "quote",
+ "proc-macro2 1.0.39",
+ "quote 1.0.18",
  "version_check",
 ]
 
+[[package]]
+name = "proc-macro2"
+version = "0.4.30"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
+dependencies = [
+ "unicode-xid 0.1.0",
+]
+
 [[package]]
 name = "proc-macro2"
 version = "1.0.39"
@@ -1654,13 +1670,22 @@ dependencies = [
  "memchr",
 ]
 
+[[package]]
+name = "quote"
+version = "0.6.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
+dependencies = [
+ "proc-macro2 0.4.30",
+]
+
 [[package]]
 name = "quote"
 version = "1.0.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
 dependencies = [
- "proc-macro2",
+ "proc-macro2 1.0.39",
 ]
 
 [[package]]
@@ -1823,8 +1848,8 @@ version = "0.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "bb35a55ab810b5c0fe31606fe9b47d1354e4dc519bec0a102655f78ea2b38057"
 dependencies = [
- "quote",
- "syn",
+ "quote 1.0.18",
+ "syn 1.0.95",
 ]
 
 [[package]]
@@ -1896,9 +1921,9 @@ version = "1.0.137"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be"
 dependencies = [
- "proc-macro2",
- "quote",
- "syn",
+ "proc-macro2 1.0.39",
+ "quote 1.0.18",
+ "syn 1.0.95",
 ]
 
 [[package]]
@@ -1918,9 +1943,9 @@ version = "0.1.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "a2ad84e47328a31223de7fed7a4f5087f2d6ddfe586cf3ca25b7a165bc0a5aed"
 dependencies = [
- "proc-macro2",
- "quote",
- "syn",
+ "proc-macro2 1.0.39",
+ "quote 1.0.18",
+ "syn 1.0.95",
 ]
 
 [[package]]
@@ -2085,9 +2110,9 @@ checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
 dependencies = [
  "heck",
  "proc-macro-error",
- "proc-macro2",
- "quote",
- "syn",
+ "proc-macro2 1.0.39",
+ "quote 1.0.18",
+ "syn 1.0.95",
 ]
 
 [[package]]
@@ -2113,14 +2138,25 @@ dependencies = [
  "symbolic-common",
 ]
 
+[[package]]
+name = "syn"
+version = "0.15.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
+dependencies = [
+ "proc-macro2 0.4.30",
+ "quote 0.6.13",
+ "unicode-xid 0.1.0",
+]
+
 [[package]]
 name = "syn"
 version = "1.0.95"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "fbaf6116ab8924f39d52792136fb74fd60a80194cf1b1c6ffa6453eef1c3f942"
 dependencies = [
- "proc-macro2",
- "quote",
+ "proc-macro2 1.0.39",
+ "quote 1.0.18",
  "unicode-ident",
 ]
 
@@ -2194,6 +2230,18 @@ dependencies = [
  "unicode-width",
 ]
 
+[[package]]
+name = "test-generator"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b23be2add79223226e1cb6446cb3e37506a5927089870687a0f1149bb7a073a"
+dependencies = [
+ "glob",
+ "proc-macro2 0.4.30",
+ "quote 0.6.13",
+ "syn 0.15.44",
+]
+
 [[package]]
 name = "textwrap"
 version = "0.11.0"
@@ -2218,9 +2266,9 @@ version = "1.0.31"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
 dependencies = [
- "proc-macro2",
- "quote",
- "syn",
+ "proc-macro2 1.0.39",
+ "quote 1.0.18",
+ "syn 1.0.95",
 ]
 
 [[package]]
@@ -2350,6 +2398,12 @@ version = "0.1.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
 
+[[package]]
+name = "unicode-xid"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
+
 [[package]]
 name = "unicode-xid"
 version = "0.2.3"
@@ -2449,9 +2503,9 @@ dependencies = [
  "bumpalo",
  "log",
  "once_cell",
- "proc-macro2",
- "quote",
- "syn",
+ "proc-macro2 1.0.39",
+ "quote 1.0.18",
+ "syn 1.0.95",
  "wasm-bindgen-shared",
 ]
 
@@ -2461,7 +2515,7 @@ version = "0.2.83"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
 dependencies = [
- "quote",
+ "quote 1.0.18",
  "wasm-bindgen-macro-support",
 ]
 
@@ -2471,9 +2525,9 @@ version = "0.2.83"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
 dependencies = [
- "proc-macro2",
- "quote",
- "syn",
+ "proc-macro2 1.0.39",
+ "quote 1.0.18",
+ "syn 1.0.95",
  "wasm-bindgen-backend",
  "wasm-bindgen-shared",
 ]
diff --git a/Cargo.toml b/Cargo.toml
index e1557215..99c00e44 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -70,6 +70,7 @@ criterion = "0.3"
 pprof = { version = "0.9.1", features = ["criterion", "flamegraph"] }
 nickel-lang-utilities = {path = "utilities", version = "0.3.0"}
 similar = "2.1.0"
+test-generator = "0.3.1"
 
 [workspace]
 members = [
diff --git a/RELEASING.md b/RELEASING.md
index 2e337443..6ab0426a 100644
--- a/RELEASING.md
+++ b/RELEASING.md
@@ -75,10 +75,11 @@ crates and dependent repositories (such as the website) in a consistent state.
 
    **Commit those changes temporarily to please cargo, but they will be
    dropped later. Do not push**.
-2. Check that `cargo publish --dry-run` succeeds. You may have to create an
-   account on `crates.io` and get a key for `nickel-lang` and
-   `nickel-lang-lsp`: please refer to cargo documentation and contact the
-   Nickel maintainers.
+2. Check that `cargo publish --dry-run` succeeds. For this to work, you will
+   need to be signed in to `crates.io` with a GitHub account that is part of
+   the [Nickel Core team](https://github.com/orgs/nickel-lang/teams/core),
+   and have a `crates.io` API key saved locally on your machine (normally
+   via `cargo login`). For help with this, contact the Nickel maintainers.
 3. Release on crates.io: `cargo publish`
 4. Ditch the potential changes made to the cargo manifests at step 1. by
    dropping the corresponding commit.
@@ -107,7 +108,7 @@ crates and dependent repositories (such as the website) in a consistent state.
    $git checkout -b release/X.Y.Z
    $nix flake lock --update-input nickel
    $git add flake.lock
-   $git ci -m "Update to Nickel vX.Y.Z"
+   $git commit -m "Update to Nickel vX.Y.Z"
    $git push -u origin @
    ```
 


Test patch:
diff --git a/tests/integration/pass.rs b/tests/integration/pass.rs
index 9070d37a..8ab13ade 100644
--- a/tests/integration/pass.rs
+++ b/tests/integration/pass.rs
@@ -3,6 +3,7 @@ use nickel_lang_utilities::TestProgram;
 use std::ffi::OsString;
 use std::path::PathBuf;
 use std::thread;
+use test_generator::test_resources;
 
 // By default, tests are run with 2MB stack size, which can overflow in debug mode. We run the
 // tests with an increased stack size.
@@ -19,9 +20,10 @@ fn run(path: impl Into<OsString>) {
     );
 }
 
+#[test_resources("tests/integration/pass/*.ncl")]
 fn check_file(file: &str) {
     let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
-    path.push(format!("tests/integration/pass/{}", file));
+    path.push(file);
 
     thread::Builder::new()
         .name(String::from(file))
@@ -31,109 +33,3 @@ fn check_file(file: &str) {
         .join()
         .unwrap();
 }
-
-#[test]
-fn basics() {
-    check_file("basics.ncl");
-}
-
-#[test]
-fn builtins() {
-    check_file("builtins.ncl");
-}
-
-#[test]
-fn complete() {
-    check_file("complete.ncl");
-}
-
-#[test]
-fn contracts() {
-    check_file("contracts.ncl");
-}
-
-#[test]
-fn eq() {
-    check_file("eq.ncl")
-}
-
-#[test]
-fn functions() {
-    check_file("functions.ncl");
-}
-
-#[test]
-fn arrays() {
-    check_file("arrays.ncl");
-}
-
-#[test]
-fn metavalues() {
-    check_file("metavalues.ncl");
-}
-
-#[test]
-fn records() {
-    check_file("records.ncl");
-}
-
-#[test]
-fn record_defs() {
-    check_file("record-defs.ncl");
-}
-
-#[test]
-fn strings() {
-    check_file("strings.ncl");
-}
-
-#[test]
-fn typechecking() {
-    check_file("typechecking.ncl");
-}
-
-#[test]
-fn types() {
-    check_file("types.ncl");
-}
-
-#[test]
-fn serialize() {
-    check_file("serialize.ncl");
-    check_file("serialize-package.ncl");
-}
-
-#[test]
-fn annot_parsing() {
-    check_file("annotations.ncl");
-}
-
-#[test]
-fn importing() {
-    check_file("import.ncl");
-}
-
-#[test]
-fn overriding() {
-    check_file("overriding.ncl");
-}
-
-#[test]
-fn recursive_let() {
-    check_file("recursive_let.ncl");
-}
-
-#[test]
-fn quote_in_indentifier() {
-    check_file("quote_in_identifier.ncl")
-}
-
-#[test]
-fn priorities() {
-    check_file("priorities.ncl")
-}
-
-#[test]
-fn multiple_overrides() {
-    check_file("multiple-overrides.ncl")
-}
diff --git a/tests/integration/pass/annotations.ncl b/tests/integration/pass/annotations.ncl
index 4146d2d7..718b4f46 100644
--- a/tests/integration/pass/annotations.ncl
+++ b/tests/integration/pass/annotations.ncl
@@ -1,4 +1,4 @@
-let {check, Assert, ..} = import "testlib.ncl" in
+let {check, Assert, ..} = import "lib/assert.ncl" in
 
 [
   # left_annot_precedence
diff --git a/tests/integration/pass/arrays.ncl b/tests/integration/pass/arrays.ncl
index 687320a5..244ac7a5 100644
--- a/tests/integration/pass/arrays.ncl
+++ b/tests/integration/pass/arrays.ncl
@@ -1,4 +1,4 @@
-let {check, ..} = import "testlib.ncl" in
+let {check, ..} = import "lib/assert.ncl" in
 
 [
   # accesses
diff --git a/tests/integration/pass/basics.ncl b/tests/integration/pass/basics.ncl
index efcc3161..8dff4222 100644
--- a/tests/integration/pass/basics.ncl
+++ b/tests/integration/pass/basics.ncl
@@ -1,4 +1,4 @@
-let {check, ..} = import "testlib.ncl" in
+let {check, ..} = import "lib/assert.ncl" in
 
 [
   # basic arithmetic
diff --git a/tests/integration/pass/builtins.ncl b/tests/integration/pass/builtins.ncl
index 5ef76d99..cc724aab 100644
--- a/tests/integration/pass/builtins.ncl
+++ b/tests/integration/pass/builtins.ncl
@@ -1,4 +1,4 @@
-let {check, ..} = import "testlib.ncl" in
+let {check, ..} = import "lib/assert.ncl" in
 
 [
   # is_record
diff --git a/tests/integration/pass/complete.ncl b/tests/integration/pass/complete.ncl
index 485382e0..16537223 100644
--- a/tests/integration/pass/complete.ncl
+++ b/tests/integration/pass/complete.ncl
@@ -1,4 +1,4 @@
-let {Assert, ..} = import "testlib.ncl" in
+let {Assert, ..} = import "lib/assert.ncl" in
 
 let Y | ((Num -> Num) -> Num -> Num) -> Num -> Num = fun f => (fun x => f (x x)) (fun x => f (x x)) in
 let dec : Num -> Num = fun x => x + (-1) in
diff --git a/tests/integration/pass/contracts.ncl b/tests/integration/pass/contracts.ncl
index 383e4ab4..4252689e 100644
--- a/tests/integration/pass/contracts.ncl
+++ b/tests/integration/pass/contracts.ncl
@@ -1,4 +1,4 @@
-let {check, Assert, ..} = import "testlib.ncl" in
+let {check, Assert, ..} = import "lib/assert.ncl" in
 
 [
   let AlwaysTrue = fun l t =>
diff --git a/tests/integration/pass/eq.ncl b/tests/integration/pass/eq.ncl
index 4b0ae086..09b63e21 100644
--- a/tests/integration/pass/eq.ncl
+++ b/tests/integration/pass/eq.ncl
@@ -1,4 +1,4 @@
-let {check, ..} = import "testlib.ncl" in
+let {check, ..} = import "lib/assert.ncl" in
 
 [
   # basic
diff --git a/tests/integration/pass/functions.ncl b/tests/integration/pass/functions.ncl
index ab5cf036..35bb110d 100644
--- a/tests/integration/pass/functions.ncl
+++ b/tests/integration/pass/functions.ncl
@@ -1,4 +1,4 @@
-let {check, ..} = import "testlib.ncl" in
+let {check, ..} = import "lib/assert.ncl" in
 
 [
   (fun x => x) 3 == 3,
diff --git a/tests/integration/pass/import.ncl b/tests/integration/pass/import.ncl
index 44f234c2..b8290a4f 100644
--- a/tests/integration/pass/import.ncl
+++ b/tests/integration/pass/import.ncl
@@ -1,3 +1,3 @@
-let {Assert, ..} = import "testlib.ncl" in
+let {Assert, ..} = import "lib/assert.ncl" in
 
-(import "imported.ncl" 3 == 3 | Assert)
+(import "lib/imported.ncl" 3 == 3 | Assert)
diff --git a/tests/integration/pass/testlib.ncl b/tests/integration/pass/lib/assert.ncl
similarity index 100%
rename from tests/integration/pass/testlib.ncl
rename to tests/integration/pass/lib/assert.ncl
diff --git a/tests/integration/pass/imported.ncl b/tests/integration/pass/lib/imported.ncl
similarity index 100%
rename from tests/integration/pass/imported.ncl
rename to tests/integration/pass/lib/imported.ncl
diff --git a/tests/integration/pass/typed-import.ncl b/tests/integration/pass/lib/typed-import.ncl
similarity index 100%
rename from tests/integration/pass/typed-import.ncl
rename to tests/integration/pass/lib/typed-import.ncl
diff --git a/tests/integration/pass/metavalues.ncl b/tests/integration/pass/metavalues.ncl
index 4533796d..0f6e30c3 100644
--- a/tests/integration/pass/metavalues.ncl
+++ b/tests/integration/pass/metavalues.ncl
@@ -1,4 +1,4 @@
-let {check, Assert, ..} = import "testlib.ncl" in
+let {check, Assert, ..} = import "lib/assert.ncl" in
 
 [
   {val | default | Num = 10}.val == 10,
diff --git a/tests/integration/pass/multiple-overrides.ncl b/tests/integration/pass/multiple-overrides.ncl
index afc6fba9..8890c150 100644
--- a/tests/integration/pass/multiple-overrides.ncl
+++ b/tests/integration/pass/multiple-overrides.ncl
@@ -1,4 +1,4 @@
-let {check, ..} = import "testlib.ncl" in
+let {check, ..} = import "lib/assert.ncl" in
 
 [
   # regression test for issue #908 (https://github.com/tweag/nickel/issues/908)
diff --git a/tests/integration/pass/overriding.ncl b/tests/integration/pass/overriding.ncl
index 72c94912..06f4a7be 100644
--- a/tests/integration/pass/overriding.ncl
+++ b/tests/integration/pass/overriding.ncl
@@ -1,4 +1,4 @@
-let {check, ..} = import "testlib.ncl" in
+let {check, ..} = import "lib/assert.ncl" in
 
 [
   {foo | default = 1} & {foo = 2} == {foo = 2},
diff --git a/tests/integration/pass/priorities.ncl b/tests/integration/pass/priorities.ncl
index b0580aa7..5ff41127 100644
--- a/tests/integration/pass/priorities.ncl
+++ b/tests/integration/pass/priorities.ncl
@@ -1,4 +1,4 @@
-let {Assert, check, ..} =  import "testlib.ncl" in
+let {Assert, check, ..} =  import "lib/assert.ncl" in
 
 [
   let block1 = {
diff --git a/tests/integration/pass/quote_in_identifier.ncl b/tests/integration/pass/quote_in_identifier.ncl
index 35ad3bf9..5d4c5df4 100644
--- a/tests/integration/pass/quote_in_identifier.ncl
+++ b/tests/integration/pass/quote_in_identifier.ncl
@@ -1,3 +1,3 @@
-let {Assert, ..} = import "testlib.ncl" in
+let {Assert, ..} = import "lib/assert.ncl" in
 
 let this-isn't-invalid = true in this-isn't-invalid | Assert
diff --git a/tests/integration/pass/record-defs.ncl b/tests/integration/pass/record-defs.ncl
index 8d57094f..e3b67ded 100644
--- a/tests/integration/pass/record-defs.ncl
+++ b/tests/integration/pass/record-defs.ncl
@@ -1,4 +1,4 @@
-let {check, ..} = import "testlib.ncl" in
+let {check, ..} = import "lib/assert.ncl" in
 
 [
   # piecewise_definitions
diff --git a/tests/integration/pass/records.ncl b/tests/integration/pass/records.ncl
index 303c9610..b5076845 100644
--- a/tests/integration/pass/records.ncl
+++ b/tests/integration/pass/records.ncl
@@ -1,4 +1,4 @@
-let {check, ..} = import "testlib.ncl" in
+let {check, ..} = import "lib/assert.ncl" in
 
 [
   # accesses
diff --git a/tests/integration/pass/recursive_let.ncl b/tests/integration/pass/recursive_let.ncl
index a866dbfc..06e9d40d 100644
--- a/tests/integration/pass/recursive_let.ncl
+++ b/tests/integration/pass/recursive_let.ncl
@@ -1,4 +1,4 @@
-let {check, ..} = import "testlib.ncl" in
+let {check, ..} = import "lib/assert.ncl" in
 
 [
   let rec f = fun n => if n == 0 then n else f (n - 1) in f 10 == 0,
diff --git a/tests/integration/pass/serialize.ncl b/tests/integration/pass/serialize.ncl
index 13acf4e9..965f2942 100644
--- a/tests/integration/pass/serialize.ncl
+++ b/tests/integration/pass/serialize.ncl
@@ -1,4 +1,4 @@
-let {check, ..} = import "testlib.ncl" in
+let {check, ..} = import "lib/assert.ncl" in
 
 let assertSerInv = fun x =>
     let assertAux = fun format x =>
diff --git a/tests/integration/pass/strings.ncl b/tests/integration/pass/strings.ncl
index 65eb7ca2..f7129739 100644
--- a/tests/integration/pass/strings.ncl
+++ b/tests/integration/pass/strings.ncl
@@ -1,4 +1,4 @@
-let {check, ..} = import "testlib.ncl" in
+let {check, ..} = import "lib/assert.ncl" in
 
 [
   # interpolation
diff --git a/tests/integration/pass/typechecking.ncl b/tests/integration/pass/typechecking.ncl
index 42b47240..5c040ba4 100644
--- a/tests/integration/pass/typechecking.ncl
+++ b/tests/integration/pass/typechecking.ncl
@@ -176,10 +176,10 @@ let typecheck = [
   (let x = {val : Num | doc "some" | default = 1}.val in x + 1) : Num,
 
   # Typed import
-  import "typed-import.ncl" : Num,
+  import "lib/typed-import.ncl" : Num,
 
   # Regression test for #430 (https://github.com/tweag/nickel/issues/430)
-  let x = import "typed-import.ncl"
+  let x = import "lib/typed-import.ncl"
   in x : Num,
 
   # recursive_records_quoted
diff --git a/tests/integration/pass/types.ncl b/tests/integration/pass/types.ncl
index a422b9bb..fac37312 100644
--- a/tests/integration/pass/types.ncl
+++ b/tests/integration/pass/types.ncl
@@ -1,4 +1,4 @@
-let {Assert, ..} = import "testlib.ncl" in
+let {Assert, ..} = import "lib/assert.ncl" in
 
 (let plus : Num -> Num -> Num = fun x => fun y => x + y in
  plus (54 : Num) (6 : Num) == 60 | Assert)