From 00a3d2e585bfa011308812cfe1f00bf8e6362118 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 22 Feb 2026 21:49:12 +0300 Subject: [PATCH] tests: update test cases for newer syntax items; drop old artifacts Signed-off-by: NotAShelf Change-Id: I8640148e8e7597924f9c776750c856266a6a6964 --- tests/ancient_let.nix | 8 ++++++++ tests/attrset.nixir | Bin 109 -> 0 bytes tests/block_comments.nix | 12 ++++++++++++ tests/comparison.nixir | Bin 107 -> 0 bytes tests/dynamic_attrs.nix | 15 +++++++++++++++ tests/home_path.nix | 11 +++++++++++ tests/if.nixir | Bin 58 -> 0 bytes tests/indented_string.nix | 31 +++++++++++++++++++++++++++++++ tests/let.nixir | Bin 75 -> 0 bytes tests/list_concat.nix | 15 +++++++++++++++ tests/logical.nixir | Bin 149 -> 0 bytes tests/nested_attrs.nix | 13 +++++++++++++ tests/operators.nixir | Bin 109 -> 0 bytes tests/or_in_attrset.nix | 6 ++++++ tests/or_simple.nix | 4 ++++ tests/path_concat.nix | 13 +++++++++++++ tests/precedence.nixir | Bin 318 -> 0 bytes tests/select_or_default.nix | 16 ++++++++++++++++ tests/simple.nixir | Bin 34 -> 0 bytes tests/simple_op.nixir | Bin 53 -> 0 bytes tests/unary.nixir | Bin 113 -> 0 bytes 21 files changed, 144 insertions(+) create mode 100644 tests/ancient_let.nix delete mode 100644 tests/attrset.nixir create mode 100644 tests/block_comments.nix delete mode 100644 tests/comparison.nixir create mode 100644 tests/dynamic_attrs.nix create mode 100644 tests/home_path.nix delete mode 100644 tests/if.nixir create mode 100644 tests/indented_string.nix delete mode 100644 tests/let.nixir create mode 100644 tests/list_concat.nix delete mode 100644 tests/logical.nixir create mode 100644 tests/nested_attrs.nix delete mode 100644 tests/operators.nixir create mode 100644 tests/or_in_attrset.nix create mode 100644 tests/or_simple.nix create mode 100644 tests/path_concat.nix delete mode 100644 tests/precedence.nixir create mode 100644 tests/select_or_default.nix delete mode 100644 tests/simple.nixir delete mode 100644 tests/simple_op.nixir delete mode 100644 tests/unary.nixir diff --git a/tests/ancient_let.nix b/tests/ancient_let.nix new file mode 100644 index 0000000..3d4cfec --- /dev/null +++ b/tests/ancient_let.nix @@ -0,0 +1,8 @@ +# Test ancient let syntax: let { bindings; body = expr; } +# This is equivalent to: let bindings in expr, but has been deprecated +# in newer Nix versions. +let { + x = 10; + y = 20; + body = x + y; +} diff --git a/tests/attrset.nixir b/tests/attrset.nixir deleted file mode 100644 index 708f5ddd3bfd673373e97f8e7fb2703ef3e2b501..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 109 zcmazD^7Lb3Kn08jU_LXDWC7y5#N1S{5)h{(wYY>8NS7t%l%_HQ84T4R0tncEI1ebB VngY=dk_4&D%*#tH0%>Jn1OQ!e3}FBO diff --git a/tests/block_comments.nix b/tests/block_comments.nix new file mode 100644 index 0000000..b5de60f --- /dev/null +++ b/tests/block_comments.nix @@ -0,0 +1,12 @@ +# Test block comments /* */ +/* This is a block comment */ +let + x = 42; /* inline block comment */ + /* Multi-line + block + comment */ + y = 100; +in +/* Comment before expression */ +x + y +/* Trailing comment */ diff --git a/tests/comparison.nixir b/tests/comparison.nixir deleted file mode 100644 index fb7b4fd62f9b8ac0f3c19b3a9c5eb7b0dcc7058f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 107 zcmazD^7Lb3Kn08eAU;Tx5r`8(1Opd{00Iyv2`nN4<})xjfM_KU!7czIK>*AEsbT@~ I7{Me10PPL~4*&oF diff --git a/tests/dynamic_attrs.nix b/tests/dynamic_attrs.nix new file mode 100644 index 0000000..3c32fd5 --- /dev/null +++ b/tests/dynamic_attrs.nix @@ -0,0 +1,15 @@ +# Test dynamic attribute names +# Note: Full dynamic attrs require runtime evaluation +# For now, testing that syntax is recognized +let + key = "mykey"; +in { + # Static attribute for comparison + static = "value"; + + # Dynamic attribute name (basic string interpolation) + # "${key}" = "dynamic_value"; + + # For now, use workaround with static names + mykey = "works"; +} diff --git a/tests/home_path.nix b/tests/home_path.nix new file mode 100644 index 0000000..ccfb107 --- /dev/null +++ b/tests/home_path.nix @@ -0,0 +1,11 @@ +# Test home-relative paths +# Note: This will resolve to the actual home directory at evaluation time +let + # Example home path (will be expanded by evaluator) + config = ~/..config; + file = ~/.bashrc; +in { + # These are just path values that will be expanded + configPath = config; + filePath = file; +} diff --git a/tests/if.nixir b/tests/if.nixir deleted file mode 100644 index 4ee0f5992c9cf0477d61dbc9a4d28e10556fff9d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 58 fcmazD^7Lb3Kn08rAU+F-U}OZ7AOZ-$9GGeVQQrZN diff --git a/tests/indented_string.nix b/tests/indented_string.nix new file mode 100644 index 0000000..16c6026 --- /dev/null +++ b/tests/indented_string.nix @@ -0,0 +1,31 @@ +# Test indented strings (multi-line strings with '' delimiters) +let + # Simple indented string + simple = '' + Hello + World + ''; + + # Indented string with interpolation + name = "Nix"; + greeting = '' + Welcome to ${name}! + This is indented. + ''; + + # Escape sequences + escapes = '' + Literal dollar: ''$ + Literal quotes: ''' + Regular text + ''; + + # Shell script example (common use case) + script = '' + #!/bin/bash + echo "Running script" + ls -la + ''; +in { + inherit simple greeting escapes script; +} diff --git a/tests/let.nixir b/tests/let.nixir deleted file mode 100644 index cb9dd4171449cba19af43f6c2cefcba863c17532..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 75 rcmazD^7Lb3Kn08eAU;Tx5r`{51Opd{00I!F5-cJD<})w|Kxqa5kZuCH diff --git a/tests/list_concat.nix b/tests/list_concat.nix new file mode 100644 index 0000000..a1b09f1 --- /dev/null +++ b/tests/list_concat.nix @@ -0,0 +1,15 @@ +# Test list concatenation operator ++ +let + list1 = [1 2 3]; + list2 = [4 5 6]; + empty = []; +in { + # Basic concatenation + combined = list1 ++ list2; + + # Concatenate with empty list + with_empty = list1 ++ empty; + + # Nested concatenation + triple = [1] ++ [2] ++ [3]; +} diff --git a/tests/logical.nixir b/tests/logical.nixir deleted file mode 100644 index 010a5f558addb374be5e2b3786b015f964a46663..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 149 zcmazD^7Lb3Kn08eAU;Tx5r`{TKs-hevl7f?Z~zG?fe3B^5D5Zc21pGELkJ-40OEjE S^59U(1X2M6U~SA0HUj{kF9W#% diff --git a/tests/nested_attrs.nix b/tests/nested_attrs.nix new file mode 100644 index 0000000..874d08b --- /dev/null +++ b/tests/nested_attrs.nix @@ -0,0 +1,13 @@ +# Test nested attribute paths +{ + # Simple nested path + a.b.c = 42; + + # Multiple nested paths + x.y = 1; + x.z = 2; + + # Mix of nested and non-nested + foo = "bar"; + nested.deep.value = 100; +} diff --git a/tests/operators.nixir b/tests/operators.nixir deleted file mode 100644 index f71f899c4b62baf38543d84c5810ffea0bb0c77b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 109 zcmazD^7Lb3Kn08eAU;Tx5r`{51Opd{00I!F5-h?B<})xTfoLW$$shm~gD^nKz)E2j F008yh0|fv8 diff --git a/tests/or_in_attrset.nix b/tests/or_in_attrset.nix new file mode 100644 index 0000000..406149b --- /dev/null +++ b/tests/or_in_attrset.nix @@ -0,0 +1,6 @@ +# Test 'or' in attrset context +let + attrs = { a = 1; }; +in { + test = attrs.a or 999; +} diff --git a/tests/or_simple.nix b/tests/or_simple.nix new file mode 100644 index 0000000..6025a4d --- /dev/null +++ b/tests/or_simple.nix @@ -0,0 +1,4 @@ +# Simplest 'or' test +let + x = { a = 1; }; +in x.a or 2 diff --git a/tests/path_concat.nix b/tests/path_concat.nix new file mode 100644 index 0000000..682175c --- /dev/null +++ b/tests/path_concat.nix @@ -0,0 +1,13 @@ +# Test path concatenation +let + # Path + string = path + p1 = ./foo + "/bar"; + + # String + path = path + p2 = "/prefix" + ./suffix; + + # Path + path = path + p3 = ./dir + ./file; +in { + inherit p1 p2 p3; +} diff --git a/tests/precedence.nixir b/tests/precedence.nixir deleted file mode 100644 index de1b0d429d5c927e4d6568f669ede994f731b166..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 318 zcmY+9%MFAu3`FC=Y7uathOK}$xFE!dD}nxN!1DqqYssTLe@4!>PICj7*4 diff --git a/tests/unary.nixir b/tests/unary.nixir deleted file mode 100644 index 652fabc4b463b276334d7d94b5fbff4d886983e0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 113 zcmazD^7Lb3Kn08eAU;Tx5r`{51Opd{00I!Fk_F5%0Fhv2%s@IXHC-7jAOI$T3c;fJ NC16oTuqY!?6aY;M1;+pY