aboutsummaryrefslogtreecommitdiff
path: root/tests/drivers/parser_growth_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/drivers/parser_growth_test.py')
-rw-r--r--tests/drivers/parser_growth_test.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/drivers/parser_growth_test.py b/tests/drivers/parser_growth_test.py
index 4cbfbb2..9aee57e 100644
--- a/tests/drivers/parser_growth_test.py
+++ b/tests/drivers/parser_growth_test.py
@@ -22,6 +22,13 @@ source = 'struct methods { int value;\n'
source += ''.join(f'int get_{i}() {{ return this.value + {i}; }}\n' for i in range(100))
source += '}\nfn main() { methods item; item.value = 7; gc(); put_n(item.get_99()); put_c(10); return 0; }\n'
run(source, '106\n')
+# grabfn owns a single token buffer while repeated growth moves replacements
+# into its released slot; the replayed method must survive compilation and gc.
+source = 'struct long_method { int seed; int count() { int value = 0;\n'
+source += 'value += 1;\n' * 400
+source += 'return value + this.seed; } };\n'
+source += 'fn main() { long_method item; item.seed = 7; gc(); put_n(item.count()); put_c(10); return 0; }\n'
+run(source, '407\n')
source = 'enum expanded {\n'
source += ',\n'.join(f'member_with_long_generated_name_{i} {{ ' + ''.join(f'int field_with_long_generated_name_{j}; ' for j in range(8)) + '}' for i in range(40))
source += '\n};\nfn main() { gc(); put_n(ebcap > 8192); put_c(10); return 0; }\n'