From a913e7df3329efaec15a08d62115449cf9e05e64 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 16 Nov 2025 08:16:41 -0600 Subject: [PATCH] handles newlines, add test to prove it --- tests/unit_tests/test_lambda_dedup.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/unit_tests/test_lambda_dedup.py b/tests/unit_tests/test_lambda_dedup.py index c112631f2d..bbf5f02e6d 100644 --- a/tests/unit_tests/test_lambda_dedup.py +++ b/tests/unit_tests/test_lambda_dedup.py @@ -227,6 +227,13 @@ def test_static_variable_detection() -> None: assert not cg._has_static_variables("int counter = 0; return counter++;") assert not cg._has_static_variables("return 42;") + # Should handle newlines between static and type/variable + assert cg._has_static_variables("static int\nfoo = 0;") + assert cg._has_static_variables("static\nint\nbar = 0;") + assert cg._has_static_variables( + "static int \n foo = 0;" + ) # Mixed spaces/newlines + def test_lambdas_with_static_not_deduplicated() -> None: """Test that lambdas with static variables are not deduplicated."""