Skip to content

Commit 8a21207

Browse files
committed
fix: Correct record field names in test files
Fixed multiple test files that were using incorrect record field names: 1. nat_type_test.erl: Changed -include_lib path from "eunit/eunit.hrl" to "eunit/include/eunit.hrl" to match other test files 2. codegen_advanced_test.erl: Fixed #param{} and #function_def{} records: - Changed 'value' to 'type' in #param{} records (correct fields: name, type, location) - Changed 'return_value' to 'return_type' in #function_def{} records 3. inlining_test.erl: Changed 'type' to 'value' in #binding{} record (correct fields: pattern, value, location) All test files now compile successfully with only minor warnings remaining.
1 parent d977399 commit 8a21207

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

test/codegen_advanced_test.erl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,8 @@ test_recursive_function_calls() ->
394394
% end
395395
FactorialFn = #function_def{
396396
name = factorial,
397-
params = [#param{name = n, value = undefined, location = create_location(1, 17)}],
398-
return_value = undefined,
397+
params = [#param{name = n, type = undefined, location = create_location(1, 17)}],
398+
return_type = undefined,
399399
constraint = undefined,
400400
body = #match_expr{
401401
expr = create_identifier('n'),
@@ -471,7 +471,7 @@ test_higher_order_function_calls() ->
471471
function = create_identifier('map'),
472472
args = [
473473
#lambda_expr{
474-
params = [#param{name = x, value = undefined, location = create_location(1, 12)}],
474+
params = [#param{name = x, type = undefined, location = create_location(1, 12)}],
475475
body = #binary_op_expr{
476476
op = '+',
477477
left = create_identifier('x'),
@@ -523,7 +523,7 @@ test_closure_generation() ->
523523
pattern = #identifier_pattern{name = f, location = create_location(2, 5)},
524524
value = #lambda_expr{
525525
params = [
526-
#param{name = y, value = undefined, location = create_location(2, 17)}
526+
#param{name = y, type = undefined, location = create_location(2, 17)}
527527
],
528528
body = #binary_op_expr{
529529
op = '+',
@@ -578,10 +578,10 @@ test_tail_call_optimization() ->
578578
FactorialTailFn = #function_def{
579579
name = factorial_tail,
580580
params = [
581-
#param{name = n, value = undefined, location = create_location(1, 22)},
582-
#param{name = acc, value = undefined, location = create_location(1, 25)}
581+
#param{name = n, type = undefined, location = create_location(1, 22)},
582+
#param{name = acc, type = undefined, location = create_location(1, 25)}
583583
],
584-
return_value = undefined,
584+
return_type = undefined,
585585
constraint = undefined,
586586
body = #match_expr{
587587
expr = create_identifier('n'),

test/inlining_test.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ sample_ast_with_let_body() ->
417417
bindings = [
418418
#binding{
419419
pattern = #identifier_pattern{name = t},
420-
type = #binary_op_expr{
420+
value = #binary_op_expr{
421421
op = '+',
422422
left = #identifier_expr{name = a},
423423
right = #identifier_expr{name = b}

test/melquiades_simple_test.erl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ run() ->
1818
test_lexer() ->
1919
Code = <<"msg |-> :server">>,
2020
{ok, Tokens} = cure_lexer:tokenize(Code),
21-
21+
2222
% Extract token types
2323
Types = [element(2, T) || T <- Tokens],
24-
24+
2525
% Verify melquiades_send token is present
2626
case lists:member(melquiades_send, Types) of
2727
true ->
@@ -36,7 +36,7 @@ test_lexer() ->
3636
%% Test that the parser creates correct AST
3737
test_parser() ->
3838
Code = <<"def test() -> None do\n msg |-> :server\nend">>,
39-
39+
4040
case cure_lexer:tokenize(Code) of
4141
{ok, Tokens} ->
4242
case cure_parser:parse(Tokens) of
@@ -60,11 +60,11 @@ test_codegen() ->
6060
target = #identifier_expr{name = server, location = undefined},
6161
location = undefined
6262
},
63-
63+
6464
% Try to compile it
6565
try
6666
{Instructions, _State} = cure_codegen:compile_expression(MelquiadesExpr),
67-
67+
6868
% Check that we got some instructions
6969
case length(Instructions) > 0 of
7070
true ->

test/nat_type_test.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%% Test suite for Nat type (Peano encoding)
22
-module(nat_type_test).
33

4-
-include_lib("eunit/eunit.hrl").
4+
-include_lib("eunit/include/eunit.hrl").
55
-include("../src/parser/cure_ast.hrl").
66

77
%% Test Nat type creation

0 commit comments

Comments
 (0)