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 708f5dd..0000000 Binary files a/tests/attrset.nixir and /dev/null differ 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 fb7b4fd..0000000 Binary files a/tests/comparison.nixir and /dev/null differ 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 4ee0f59..0000000 Binary files a/tests/if.nixir and /dev/null differ 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 cb9dd41..0000000 Binary files a/tests/let.nixir and /dev/null differ 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 010a5f5..0000000 Binary files a/tests/logical.nixir and /dev/null differ 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 f71f899..0000000 Binary files a/tests/operators.nixir and /dev/null differ 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 de1b0d4..0000000 Binary files a/tests/precedence.nixir and /dev/null differ diff --git a/tests/select_or_default.nix b/tests/select_or_default.nix new file mode 100644 index 0000000..df91875 --- /dev/null +++ b/tests/select_or_default.nix @@ -0,0 +1,16 @@ +# Test selection with 'or' default +let + attrs = { a = 1; b = 2; }; +in { + # Attribute exists - should use value from attrs + has_attr = attrs.a or 999; + + # Attribute doesn't exist - should use default + missing_attr = attrs.c or 100; + + # Nested default expression + nested = attrs.d or (attrs.a + attrs.b); + + # Default with literal + with_string = attrs.name or "default_name"; +} diff --git a/tests/simple.nixir b/tests/simple.nixir deleted file mode 100644 index 3e26f83..0000000 Binary files a/tests/simple.nixir and /dev/null differ diff --git a/tests/simple_op.nixir b/tests/simple_op.nixir deleted file mode 100644 index 18ffbd3..0000000 Binary files a/tests/simple_op.nixir and /dev/null differ diff --git a/tests/unary.nixir b/tests/unary.nixir deleted file mode 100644 index 652fabc..0000000 Binary files a/tests/unary.nixir and /dev/null differ