From 2df8dc11785fb795399ed332f56722c6a6a7f104 Mon Sep 17 00:00:00 2001 From: piegames Date: Mon, 17 Nov 2025 20:14:08 +0100 Subject: [PATCH] tests/functional2/lang: Migrate string-context tests Change-Id: I8c8f691f77eb87b52343d52a1c2a8a255ea2c887 --- tests/functional/lang/eval-okay-context.exp | 1 - tests/functional/lang/eval-okay-context.nix | 6 ------ .../lang/string-context/eval-okay-introspection.out.exp} | 0 tests/functional2/lang/string-context/eval-okay.out.exp | 1 + .../lang/string-context/in-introspection.nix} | 3 ++- tests/functional2/lang/string-context/in.nix | 6 ++++++ 6 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 tests/functional/lang/eval-okay-context.exp delete mode 100644 tests/functional/lang/eval-okay-context.nix rename tests/{functional/lang/eval-okay-context-introspection.exp => functional2/lang/string-context/eval-okay-introspection.out.exp} (100%) create mode 100644 tests/functional2/lang/string-context/eval-okay.out.exp rename tests/{functional/lang/eval-okay-context-introspection.nix => functional2/lang/string-context/in-introspection.nix} (91%) create mode 100644 tests/functional2/lang/string-context/in.nix diff --git a/tests/functional/lang/eval-okay-context.exp b/tests/functional/lang/eval-okay-context.exp deleted file mode 100644 index 2f535bdbc..000000000 --- a/tests/functional/lang/eval-okay-context.exp +++ /dev/null @@ -1 +0,0 @@ -"foo eval-okay-context.nix bar" diff --git a/tests/functional/lang/eval-okay-context.nix b/tests/functional/lang/eval-okay-context.nix deleted file mode 100644 index 7b9531cfe..000000000 --- a/tests/functional/lang/eval-okay-context.nix +++ /dev/null @@ -1,6 +0,0 @@ -let s = "foo ${builtins.substring 33 100 (baseNameOf "${./eval-okay-context.nix}")} bar"; -in - if s != "foo eval-okay-context.nix bar" - then abort "context not discarded" - else builtins.unsafeDiscardStringContext s - diff --git a/tests/functional/lang/eval-okay-context-introspection.exp b/tests/functional2/lang/string-context/eval-okay-introspection.out.exp similarity index 100% rename from tests/functional/lang/eval-okay-context-introspection.exp rename to tests/functional2/lang/string-context/eval-okay-introspection.out.exp diff --git a/tests/functional2/lang/string-context/eval-okay.out.exp b/tests/functional2/lang/string-context/eval-okay.out.exp new file mode 100644 index 000000000..947c69538 --- /dev/null +++ b/tests/functional2/lang/string-context/eval-okay.out.exp @@ -0,0 +1 @@ +"foo in.nix bar" diff --git a/tests/functional/lang/eval-okay-context-introspection.nix b/tests/functional2/lang/string-context/in-introspection.nix similarity index 91% rename from tests/functional/lang/eval-okay-context-introspection.nix rename to tests/functional2/lang/string-context/in-introspection.nix index 8886cf32e..8cd213d71 100644 --- a/tests/functional/lang/eval-okay-context-introspection.nix +++ b/tests/functional2/lang/string-context/in-introspection.nix @@ -6,7 +6,8 @@ let outputs = [ "out" "foo" ]; }; - path = "${./eval-okay-context-introspection.nix}"; + # Note that this refers to ./in-introspection to nix, which will be copied as `in.nix` in the test environment + path = "${./in.nix}"; desired-context = { "${builtins.unsafeDiscardStringContext path}" = { diff --git a/tests/functional2/lang/string-context/in.nix b/tests/functional2/lang/string-context/in.nix new file mode 100644 index 000000000..3b8455d74 --- /dev/null +++ b/tests/functional2/lang/string-context/in.nix @@ -0,0 +1,6 @@ +let s = "foo ${builtins.substring 33 100 (baseNameOf "${./in.nix}")} bar"; +in + if s != "foo in.nix bar" + then abort "context not discarded" + else builtins.unsafeDiscardStringContext s +