From 395a331cde718ad78a1e38bfb7be0d71efcd1bc5 Mon Sep 17 00:00:00 2001 From: Jon Meow <46229924+jonmeow@users.noreply.github.com> Date: Wed, 15 Sep 2021 16:37:34 -0700 Subject: [PATCH] Reorganize tests into dirs and rename numbered tests (#825) There's a small update to update_checks.py to handle the recursive directories. Also, I'm only using one level of nesting in this PR but really no reason we can't do more. I'm just not sure what clustering is best right now. As a pattern, I'm trying to name all failing tests `fail_*.carbon`. --- .../destruct_original.carbon} | 0 .../reassign_original.carbon} | 0 .../choice.carbon} | 0 .../fail_invalid_char.carbon} | 3 +- .../fail_missing_var.carbon} | 3 +- .../testdata/{ => basic_syntax}/next.carbon | 0 .../placeholder_variable.carbon | 0 .../print.carbon} | 0 .../record.carbon} | 0 .../testdata/{ => basic_syntax}/star.carbon | 0 .../var_tuple.carbon} | 0 .../testdata/{ => basic_syntax}/zero.carbon | 0 .../{block2.carbon => block/empty.carbon} | 0 .../{block1.carbon => block/shadowing.carbon} | 0 .../assign_member.carbon} | 0 .../fail_field_access_mismatch.carbon} | 3 +- .../fail_field_mismatch.carbon} | 3 +- .../fail_field_missing.carbon} | 3 +- .../{class3.carbon => class/temp.carbon} | 0 .../{class1.carbon => class/var.carbon} | 0 .../await_maintains_scope.carbon} | 0 .../copy_in_continuation.carbon} | 0 .../creation_is_noop.carbon} | 0 .../fail_lifetime.carbon} | 3 +- .../recursive.carbon} | 0 .../run.carbon} | 0 .../run_with_await.carbon} | 0 .../shallow_copy.carbon} | 0 .../testdata/fun_named_params2.carbon | 19 ------------ .../auto_return_add.carbon} | 0 .../auto_return_modify_arg_type.carbon} | 0 .../auto_return_modify_return_type.carbon} | 0 .../auto_return_type.carbon} | 0 .../empty_params.carbon} | 0 .../fail_call_with_tuple.carbon} | 3 +- .../function/fail_named_params_order.carbon | 20 +++++++++++++ .../{funptr1.carbon => function/fnty.carbon} | 0 .../{ => function}/ignored_parameter.carbon | 0 .../multiple_args.carbon} | 0 .../named_params.carbon} | 4 ++- .../param_lifetime.carbon} | 0 .../recursive.carbon} | 0 .../{fun1.carbon => function/return.carbon} | 0 .../testdata/{ => function}/type_match.carbon | 0 .../apply.carbon} | 0 .../fail_not_addable.carbon} | 3 +- .../fail_type_deduction_mismatch.carbon} | 3 +- .../fail_type_deduction_unused.carbon} | 3 +- .../non_generic_param.carbon} | 0 .../return_val.carbon} | 0 .../swap.carbon} | 0 .../tuple_map.carbon} | 0 .../type_matching.carbon} | 0 .../fail_init_order.carbon} | 3 +- .../fail_init_type_mismatch.carbon} | 3 +- .../init_and_read.carbon} | 0 .../init_from_function.carbon} | 0 .../init_order.carbon} | 0 .../shadowing.carbon} | 3 +- .../write.carbon} | 0 .../write_from_function.carbon} | 0 .../testdata/{ => if_else}/if_else.carbon | 0 .../testdata/{ => if_else}/if_else_if.carbon | 0 .../{ => if_else}/if_else_if_else.carbon | 0 .../testdata/{ => if_else}/if_false.carbon | 0 .../testdata/{ => if_else}/if_nesting.carbon | 0 .../testdata/{ => if_else}/if_true.carbon | 0 .../fail_nonexistent_library.carbon} | 2 ++ .../fail_nonexistent_package.carbon} | 2 ++ .../fail_order.carbon} | 3 +- .../any_int.carbon} | 0 .../{match_int.carbon => match/int.carbon} | 0 .../int_default.carbon} | 0 .../testdata/{ => match}/no_match.carbon | 0 .../placeholder.carbon} | 0 .../fail_missing.carbon} | 3 +- .../with_library.carbon} | 0 .../explicit_empty.carbon} | 0 .../fail_auto.carbon} | 3 +- .../fail_explicit_with_no_return.carbon} | 3 +- .../fail_explicit_with_plain_return.carbon} | 3 +- ...fail_implicit_with_explicit_return.carbon} | 3 +- .../implicit_with_no_return.carbon} | 0 .../implicit_with_plain_return.carbon} | 0 .../{string1.carbon => string/basic.carbon} | 0 .../fail_hex_lower.carbon} | 3 +- .../fail_hex_truncated.carbon} | 3 +- .../fail_invalid_escape.carbon} | 3 +- .../fail_newline.carbon} | 3 +- .../fail_octal.carbon} | 3 +- .../fail_tab.carbon} | 3 +- .../{string3.carbon => string/hex.carbon} | 0 .../{string2.carbon => string/newline.carbon} | 0 .../assign.carbon} | 0 .../ending_comma.carbon} | 0 .../equality.carbon} | 0 .../equality_false.carbon} | 0 .../fail_equality_type.carbon} | 9 +++--- .../fail_name_order.carbon} | 2 +- .../fail_positional_order.carbon} | 2 +- .../match.carbon} | 0 .../match_nested.carbon} | 0 .../match_with_named.carbon} | 0 .../{tuple3.carbon => tuple/named.carbon} | 0 .../no_ending_comma.carbon} | 0 .../{while1.carbon => while/basic.carbon} | 0 .../{break1.carbon => while/break.carbon} | 0 .../continue.carbon} | 0 executable_semantics/update_checks.py | 30 +++++++++---------- 109 files changed, 72 insertions(+), 93 deletions(-) rename executable_semantics/testdata/{assignment_copy1.carbon => assignment_copy/destruct_original.carbon} (100%) rename executable_semantics/testdata/{assignment_copy2.carbon => assignment_copy/reassign_original.carbon} (100%) rename executable_semantics/testdata/{choice1.carbon => basic_syntax/choice.carbon} (100%) rename executable_semantics/testdata/{invalid_char.carbon => basic_syntax/fail_invalid_char.carbon} (76%) rename executable_semantics/testdata/{pattern_variable_fail.carbon => basic_syntax/fail_missing_var.carbon} (80%) rename executable_semantics/testdata/{ => basic_syntax}/next.carbon (100%) rename executable_semantics/testdata/{ => basic_syntax}/placeholder_variable.carbon (100%) rename executable_semantics/testdata/{print1.carbon => basic_syntax/print.carbon} (100%) rename executable_semantics/testdata/{record1.carbon => basic_syntax/record.carbon} (100%) rename executable_semantics/testdata/{ => basic_syntax}/star.carbon (100%) rename executable_semantics/testdata/{pattern_init.carbon => basic_syntax/var_tuple.carbon} (100%) rename executable_semantics/testdata/{ => basic_syntax}/zero.carbon (100%) rename executable_semantics/testdata/{block2.carbon => block/empty.carbon} (100%) rename executable_semantics/testdata/{block1.carbon => block/shadowing.carbon} (100%) rename executable_semantics/testdata/{class2.carbon => class/assign_member.carbon} (100%) rename executable_semantics/testdata/{class_field_access_mismatch.carbon => class/fail_field_access_mismatch.carbon} (80%) rename executable_semantics/testdata/{class_field_mismatch.carbon => class/fail_field_mismatch.carbon} (84%) rename executable_semantics/testdata/{class_field_missing.carbon => class/fail_field_missing.carbon} (84%) rename executable_semantics/testdata/{class3.carbon => class/temp.carbon} (100%) rename executable_semantics/testdata/{class1.carbon => class/var.carbon} (100%) rename executable_semantics/testdata/{experimental_continuation5.carbon => experimental_continuation/await_maintains_scope.carbon} (100%) rename executable_semantics/testdata/{experimental_continuation7.carbon => experimental_continuation/copy_in_continuation.carbon} (100%) rename executable_semantics/testdata/{experimental_continuation1.carbon => experimental_continuation/creation_is_noop.carbon} (100%) rename executable_semantics/testdata/{experimental_continuation9.carbon => experimental_continuation/fail_lifetime.carbon} (85%) rename executable_semantics/testdata/{experimental_continuation6.carbon => experimental_continuation/recursive.carbon} (100%) rename executable_semantics/testdata/{experimental_continuation2.carbon => experimental_continuation/run.carbon} (100%) rename executable_semantics/testdata/{experimental_continuation3.carbon => experimental_continuation/run_with_await.carbon} (100%) rename executable_semantics/testdata/{experimental_continuation4.carbon => experimental_continuation/shallow_copy.carbon} (100%) delete mode 100644 executable_semantics/testdata/fun_named_params2.carbon rename executable_semantics/testdata/{fun5.carbon => function/auto_return_add.carbon} (100%) rename executable_semantics/testdata/{type_compute3.carbon => function/auto_return_modify_arg_type.carbon} (100%) rename executable_semantics/testdata/{type_compute2.carbon => function/auto_return_modify_return_type.carbon} (100%) rename executable_semantics/testdata/{type_compute.carbon => function/auto_return_type.carbon} (100%) rename executable_semantics/testdata/{fun4.carbon => function/empty_params.carbon} (100%) rename executable_semantics/testdata/{fun6_fail_type.carbon => function/fail_call_with_tuple.carbon} (85%) create mode 100644 executable_semantics/testdata/function/fail_named_params_order.carbon rename executable_semantics/testdata/{funptr1.carbon => function/fnty.carbon} (100%) rename executable_semantics/testdata/{ => function}/ignored_parameter.carbon (100%) rename executable_semantics/testdata/{fun3.carbon => function/multiple_args.carbon} (100%) rename executable_semantics/testdata/{fun_named_params.carbon => function/named_params.carbon} (91%) rename executable_semantics/testdata/{fun2.carbon => function/param_lifetime.carbon} (100%) rename executable_semantics/testdata/{fun_recur.carbon => function/recursive.carbon} (100%) rename executable_semantics/testdata/{fun1.carbon => function/return.carbon} (100%) rename executable_semantics/testdata/{ => function}/type_match.carbon (100%) rename executable_semantics/testdata/{generic_function_apply.carbon => generic_function/apply.carbon} (100%) rename executable_semantics/testdata/{generic_function_fail3.carbon => generic_function/fail_not_addable.carbon} (82%) rename executable_semantics/testdata/{generic_function_fail1.carbon => generic_function/fail_type_deduction_mismatch.carbon} (80%) rename executable_semantics/testdata/{generic_function_fail2.carbon => generic_function/fail_type_deduction_unused.carbon} (77%) rename executable_semantics/testdata/{generic_function3.carbon => generic_function/non_generic_param.carbon} (100%) rename executable_semantics/testdata/{generic_function1.carbon => generic_function/return_val.carbon} (100%) rename executable_semantics/testdata/{generic_function_swap.carbon => generic_function/swap.carbon} (100%) rename executable_semantics/testdata/{generic_function_tuple_map.carbon => generic_function/tuple_map.carbon} (100%) rename executable_semantics/testdata/{generic_function2.carbon => generic_function/type_matching.carbon} (100%) rename executable_semantics/testdata/{global_variable8.carbon => global_variable/fail_init_order.carbon} (84%) rename executable_semantics/testdata/{global_variable3.carbon => global_variable/fail_init_type_mismatch.carbon} (81%) rename executable_semantics/testdata/{global_variable1.carbon => global_variable/init_and_read.carbon} (100%) rename executable_semantics/testdata/{global_variable7.carbon => global_variable/init_from_function.carbon} (100%) rename executable_semantics/testdata/{global_variable6.carbon => global_variable/init_order.carbon} (100%) rename executable_semantics/testdata/{global_variable5.carbon => global_variable/shadowing.carbon} (84%) rename executable_semantics/testdata/{global_variable4.carbon => global_variable/write.carbon} (100%) rename executable_semantics/testdata/{global_variable2.carbon => global_variable/write_from_function.carbon} (100%) rename executable_semantics/testdata/{ => if_else}/if_else.carbon (100%) rename executable_semantics/testdata/{ => if_else}/if_else_if.carbon (100%) rename executable_semantics/testdata/{ => if_else}/if_else_if_else.carbon (100%) rename executable_semantics/testdata/{ => if_else}/if_false.carbon (100%) rename executable_semantics/testdata/{ => if_else}/if_nesting.carbon (100%) rename executable_semantics/testdata/{ => if_else}/if_true.carbon (100%) rename executable_semantics/testdata/{import_nonexistent_library.carbon => import/fail_nonexistent_library.carbon} (91%) rename executable_semantics/testdata/{import_nonexistent_package.carbon => import/fail_nonexistent_package.carbon} (92%) rename executable_semantics/testdata/{import_late.carbon => import/fail_order.carbon} (79%) rename executable_semantics/testdata/{match_any_int.carbon => match/any_int.carbon} (100%) rename executable_semantics/testdata/{match_int.carbon => match/int.carbon} (100%) rename executable_semantics/testdata/{match_int_default.carbon => match/int_default.carbon} (100%) rename executable_semantics/testdata/{ => match}/no_match.carbon (100%) rename executable_semantics/testdata/{match_placeholder.carbon => match/placeholder.carbon} (100%) rename executable_semantics/testdata/{package_missing.carbon => package/fail_missing.carbon} (77%) rename executable_semantics/testdata/{package_library.carbon => package/with_library.carbon} (100%) rename executable_semantics/testdata/{return_empty_explicit.carbon => return/explicit_empty.carbon} (100%) rename executable_semantics/testdata/{return_auto.carbon => return/fail_auto.carbon} (82%) rename executable_semantics/testdata/{return_empty_implicit_fail1.carbon => return/fail_explicit_with_no_return.carbon} (72%) rename executable_semantics/testdata/{return_empty_implicit_fail2.carbon => return/fail_explicit_with_plain_return.carbon} (75%) rename executable_semantics/testdata/{return_empty_explicit_fail.carbon => return/fail_implicit_with_explicit_return.carbon} (74%) rename executable_semantics/testdata/{return_empty_implicit1.carbon => return/implicit_with_no_return.carbon} (100%) rename executable_semantics/testdata/{return_empty_implicit2.carbon => return/implicit_with_plain_return.carbon} (100%) rename executable_semantics/testdata/{string1.carbon => string/basic.carbon} (100%) rename executable_semantics/testdata/{string_fail3.carbon => string/fail_hex_lower.carbon} (80%) rename executable_semantics/testdata/{string_fail2.carbon => string/fail_hex_truncated.carbon} (80%) rename executable_semantics/testdata/{string_fail1.carbon => string/fail_invalid_escape.carbon} (80%) rename executable_semantics/testdata/{string_fail5.carbon => string/fail_newline.carbon} (80%) rename executable_semantics/testdata/{string_fail4.carbon => string/fail_octal.carbon} (80%) rename executable_semantics/testdata/{string_fail6.carbon => string/fail_tab.carbon} (81%) rename executable_semantics/testdata/{string3.carbon => string/hex.carbon} (100%) rename executable_semantics/testdata/{string2.carbon => string/newline.carbon} (100%) rename executable_semantics/testdata/{tuple_assign.carbon => tuple/assign.carbon} (100%) rename executable_semantics/testdata/{tuple2.carbon => tuple/ending_comma.carbon} (100%) rename executable_semantics/testdata/{tuple_equality.carbon => tuple/equality.carbon} (100%) rename executable_semantics/testdata/{tuple_equality2.carbon => tuple/equality_false.carbon} (100%) rename executable_semantics/testdata/{tuple_equality3.carbon => tuple/fail_equality_type.carbon} (81%) rename executable_semantics/testdata/{tuple5.carbon => tuple/fail_name_order.carbon} (80%) rename executable_semantics/testdata/{tuple4.carbon => tuple/fail_positional_order.carbon} (79%) rename executable_semantics/testdata/{tuple_match.carbon => tuple/match.carbon} (100%) rename executable_semantics/testdata/{tuple_match3.carbon => tuple/match_nested.carbon} (100%) rename executable_semantics/testdata/{tuple_match2.carbon => tuple/match_with_named.carbon} (100%) rename executable_semantics/testdata/{tuple3.carbon => tuple/named.carbon} (100%) rename executable_semantics/testdata/{tuple1.carbon => tuple/no_ending_comma.carbon} (100%) rename executable_semantics/testdata/{while1.carbon => while/basic.carbon} (100%) rename executable_semantics/testdata/{break1.carbon => while/break.carbon} (100%) rename executable_semantics/testdata/{continue1.carbon => while/continue.carbon} (100%) diff --git a/executable_semantics/testdata/assignment_copy1.carbon b/executable_semantics/testdata/assignment_copy/destruct_original.carbon similarity index 100% rename from executable_semantics/testdata/assignment_copy1.carbon rename to executable_semantics/testdata/assignment_copy/destruct_original.carbon diff --git a/executable_semantics/testdata/assignment_copy2.carbon b/executable_semantics/testdata/assignment_copy/reassign_original.carbon similarity index 100% rename from executable_semantics/testdata/assignment_copy2.carbon rename to executable_semantics/testdata/assignment_copy/reassign_original.carbon diff --git a/executable_semantics/testdata/choice1.carbon b/executable_semantics/testdata/basic_syntax/choice.carbon similarity index 100% rename from executable_semantics/testdata/choice1.carbon rename to executable_semantics/testdata/basic_syntax/choice.carbon diff --git a/executable_semantics/testdata/invalid_char.carbon b/executable_semantics/testdata/basic_syntax/fail_invalid_char.carbon similarity index 76% rename from executable_semantics/testdata/invalid_char.carbon rename to executable_semantics/testdata/basic_syntax/fail_invalid_char.carbon index a9d9f773de7b..b9ddd8da473c 100644 --- a/executable_semantics/testdata/invalid_char.carbon +++ b/executable_semantics/testdata/basic_syntax/fail_invalid_char.carbon @@ -7,7 +7,6 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/invalid_char.carbon:13: invalid character '\xEF' in source file. - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_invalid_char.carbon:12: invalid character '\xEF' in source file. � diff --git a/executable_semantics/testdata/pattern_variable_fail.carbon b/executable_semantics/testdata/basic_syntax/fail_missing_var.carbon similarity index 80% rename from executable_semantics/testdata/pattern_variable_fail.carbon rename to executable_semantics/testdata/basic_syntax/fail_missing_var.carbon index 8bf5c0b538bf..164bb93b8943 100644 --- a/executable_semantics/testdata/pattern_variable_fail.carbon +++ b/executable_semantics/testdata/basic_syntax/fail_missing_var.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/pattern_variable_fail.carbon:17: syntax error, unexpected COLON - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_missing_var.carbon:16: syntax error, unexpected COLON package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/next.carbon b/executable_semantics/testdata/basic_syntax/next.carbon similarity index 100% rename from executable_semantics/testdata/next.carbon rename to executable_semantics/testdata/basic_syntax/next.carbon diff --git a/executable_semantics/testdata/placeholder_variable.carbon b/executable_semantics/testdata/basic_syntax/placeholder_variable.carbon similarity index 100% rename from executable_semantics/testdata/placeholder_variable.carbon rename to executable_semantics/testdata/basic_syntax/placeholder_variable.carbon diff --git a/executable_semantics/testdata/print1.carbon b/executable_semantics/testdata/basic_syntax/print.carbon similarity index 100% rename from executable_semantics/testdata/print1.carbon rename to executable_semantics/testdata/basic_syntax/print.carbon diff --git a/executable_semantics/testdata/record1.carbon b/executable_semantics/testdata/basic_syntax/record.carbon similarity index 100% rename from executable_semantics/testdata/record1.carbon rename to executable_semantics/testdata/basic_syntax/record.carbon diff --git a/executable_semantics/testdata/star.carbon b/executable_semantics/testdata/basic_syntax/star.carbon similarity index 100% rename from executable_semantics/testdata/star.carbon rename to executable_semantics/testdata/basic_syntax/star.carbon diff --git a/executable_semantics/testdata/pattern_init.carbon b/executable_semantics/testdata/basic_syntax/var_tuple.carbon similarity index 100% rename from executable_semantics/testdata/pattern_init.carbon rename to executable_semantics/testdata/basic_syntax/var_tuple.carbon diff --git a/executable_semantics/testdata/zero.carbon b/executable_semantics/testdata/basic_syntax/zero.carbon similarity index 100% rename from executable_semantics/testdata/zero.carbon rename to executable_semantics/testdata/basic_syntax/zero.carbon diff --git a/executable_semantics/testdata/block2.carbon b/executable_semantics/testdata/block/empty.carbon similarity index 100% rename from executable_semantics/testdata/block2.carbon rename to executable_semantics/testdata/block/empty.carbon diff --git a/executable_semantics/testdata/block1.carbon b/executable_semantics/testdata/block/shadowing.carbon similarity index 100% rename from executable_semantics/testdata/block1.carbon rename to executable_semantics/testdata/block/shadowing.carbon diff --git a/executable_semantics/testdata/class2.carbon b/executable_semantics/testdata/class/assign_member.carbon similarity index 100% rename from executable_semantics/testdata/class2.carbon rename to executable_semantics/testdata/class/assign_member.carbon diff --git a/executable_semantics/testdata/class_field_access_mismatch.carbon b/executable_semantics/testdata/class/fail_field_access_mismatch.carbon similarity index 80% rename from executable_semantics/testdata/class_field_access_mismatch.carbon rename to executable_semantics/testdata/class/fail_field_access_mismatch.carbon index 7c266a31b0aa..28eb051ad680 100644 --- a/executable_semantics/testdata/class_field_access_mismatch.carbon +++ b/executable_semantics/testdata/class/fail_field_access_mismatch.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/class_field_access_mismatch.carbon:21: class Point does not have a field named z - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/class/fail_field_access_mismatch.carbon:20: class Point does not have a field named z package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/class_field_mismatch.carbon b/executable_semantics/testdata/class/fail_field_mismatch.carbon similarity index 84% rename from executable_semantics/testdata/class_field_mismatch.carbon rename to executable_semantics/testdata/class/fail_field_mismatch.carbon index 629d050b3e8c..2b1a6f0b2557 100644 --- a/executable_semantics/testdata/class_field_mismatch.carbon +++ b/executable_semantics/testdata/class/fail_field_mismatch.carbon @@ -7,11 +7,10 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/class_field_mismatch.carbon:23: type error in call +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/class/fail_field_mismatch.carbon:22: type error in call // CHECK: expected: (x = i32, y = i32) // CHECK: actual: (x = i32, z = i32) - package ExecutableSemanticsTest api; class Point { diff --git a/executable_semantics/testdata/class_field_missing.carbon b/executable_semantics/testdata/class/fail_field_missing.carbon similarity index 84% rename from executable_semantics/testdata/class_field_missing.carbon rename to executable_semantics/testdata/class/fail_field_missing.carbon index 25d3e3f4694d..78e7fbd89e79 100644 --- a/executable_semantics/testdata/class_field_missing.carbon +++ b/executable_semantics/testdata/class/fail_field_missing.carbon @@ -7,11 +7,10 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/class_field_missing.carbon:23: type error in call +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/class/fail_field_missing.carbon:22: type error in call // CHECK: expected: (x = i32, y = i32) // CHECK: actual: (x = i32) - package ExecutableSemanticsTest api; class Point { diff --git a/executable_semantics/testdata/class3.carbon b/executable_semantics/testdata/class/temp.carbon similarity index 100% rename from executable_semantics/testdata/class3.carbon rename to executable_semantics/testdata/class/temp.carbon diff --git a/executable_semantics/testdata/class1.carbon b/executable_semantics/testdata/class/var.carbon similarity index 100% rename from executable_semantics/testdata/class1.carbon rename to executable_semantics/testdata/class/var.carbon diff --git a/executable_semantics/testdata/experimental_continuation5.carbon b/executable_semantics/testdata/experimental_continuation/await_maintains_scope.carbon similarity index 100% rename from executable_semantics/testdata/experimental_continuation5.carbon rename to executable_semantics/testdata/experimental_continuation/await_maintains_scope.carbon diff --git a/executable_semantics/testdata/experimental_continuation7.carbon b/executable_semantics/testdata/experimental_continuation/copy_in_continuation.carbon similarity index 100% rename from executable_semantics/testdata/experimental_continuation7.carbon rename to executable_semantics/testdata/experimental_continuation/copy_in_continuation.carbon diff --git a/executable_semantics/testdata/experimental_continuation1.carbon b/executable_semantics/testdata/experimental_continuation/creation_is_noop.carbon similarity index 100% rename from executable_semantics/testdata/experimental_continuation1.carbon rename to executable_semantics/testdata/experimental_continuation/creation_is_noop.carbon diff --git a/executable_semantics/testdata/experimental_continuation9.carbon b/executable_semantics/testdata/experimental_continuation/fail_lifetime.carbon similarity index 85% rename from executable_semantics/testdata/experimental_continuation9.carbon rename to executable_semantics/testdata/experimental_continuation/fail_lifetime.carbon index 2585d872d7d0..c49440f9cc2a 100644 --- a/executable_semantics/testdata/experimental_continuation9.carbon +++ b/executable_semantics/testdata/experimental_continuation/fail_lifetime.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: RUNTIME ERROR: {{.*}}/experimental_continuation9.carbon:22: undefined behavior: access to dead value 1 - +// CHECK: RUNTIME ERROR: {{.*}}/executable_semantics/testdata/experimental_continuation/fail_lifetime.carbon:21: undefined behavior: access to dead value 1 package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/experimental_continuation6.carbon b/executable_semantics/testdata/experimental_continuation/recursive.carbon similarity index 100% rename from executable_semantics/testdata/experimental_continuation6.carbon rename to executable_semantics/testdata/experimental_continuation/recursive.carbon diff --git a/executable_semantics/testdata/experimental_continuation2.carbon b/executable_semantics/testdata/experimental_continuation/run.carbon similarity index 100% rename from executable_semantics/testdata/experimental_continuation2.carbon rename to executable_semantics/testdata/experimental_continuation/run.carbon diff --git a/executable_semantics/testdata/experimental_continuation3.carbon b/executable_semantics/testdata/experimental_continuation/run_with_await.carbon similarity index 100% rename from executable_semantics/testdata/experimental_continuation3.carbon rename to executable_semantics/testdata/experimental_continuation/run_with_await.carbon diff --git a/executable_semantics/testdata/experimental_continuation4.carbon b/executable_semantics/testdata/experimental_continuation/shallow_copy.carbon similarity index 100% rename from executable_semantics/testdata/experimental_continuation4.carbon rename to executable_semantics/testdata/experimental_continuation/shallow_copy.carbon diff --git a/executable_semantics/testdata/fun_named_params2.carbon b/executable_semantics/testdata/fun_named_params2.carbon deleted file mode 100644 index 888e6f0f4db5..000000000000 --- a/executable_semantics/testdata/fun_named_params2.carbon +++ /dev/null @@ -1,19 +0,0 @@ -// Part of the Carbon Language project, under the Apache License v2.0 with LLVM -// Exceptions. See /LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// RUN: not executable_semantics %s 2>&1 | \ -// RUN: FileCheck --match-full-lines --allow-unused-prefixes=false %s -// RUN: not executable_semantics --trace %s 2>&1 | \ -// RUN: FileCheck --match-full-lines --allow-unused-prefixes %s -// AUTOUPDATE: executable_semantics %s -// CHECK: PROGRAM ERROR: {{.*}}/fun_named_params2.carbon:15: positional members must come before named members - - -package ExecutableSemanticsTest api; - -fn f(x: i32, .d = y: i32, z: i32, .e = a: i32) => (x + y) - (z + a); - -fn main() -> i32 { - return 0; -} diff --git a/executable_semantics/testdata/fun5.carbon b/executable_semantics/testdata/function/auto_return_add.carbon similarity index 100% rename from executable_semantics/testdata/fun5.carbon rename to executable_semantics/testdata/function/auto_return_add.carbon diff --git a/executable_semantics/testdata/type_compute3.carbon b/executable_semantics/testdata/function/auto_return_modify_arg_type.carbon similarity index 100% rename from executable_semantics/testdata/type_compute3.carbon rename to executable_semantics/testdata/function/auto_return_modify_arg_type.carbon diff --git a/executable_semantics/testdata/type_compute2.carbon b/executable_semantics/testdata/function/auto_return_modify_return_type.carbon similarity index 100% rename from executable_semantics/testdata/type_compute2.carbon rename to executable_semantics/testdata/function/auto_return_modify_return_type.carbon diff --git a/executable_semantics/testdata/type_compute.carbon b/executable_semantics/testdata/function/auto_return_type.carbon similarity index 100% rename from executable_semantics/testdata/type_compute.carbon rename to executable_semantics/testdata/function/auto_return_type.carbon diff --git a/executable_semantics/testdata/fun4.carbon b/executable_semantics/testdata/function/empty_params.carbon similarity index 100% rename from executable_semantics/testdata/fun4.carbon rename to executable_semantics/testdata/function/empty_params.carbon diff --git a/executable_semantics/testdata/fun6_fail_type.carbon b/executable_semantics/testdata/function/fail_call_with_tuple.carbon similarity index 85% rename from executable_semantics/testdata/fun6_fail_type.carbon rename to executable_semantics/testdata/function/fail_call_with_tuple.carbon index c9657798ce04..ccc0fe516175 100644 --- a/executable_semantics/testdata/fun6_fail_type.carbon +++ b/executable_semantics/testdata/function/fail_call_with_tuple.carbon @@ -7,11 +7,10 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/fun6_fail_type.carbon:22: type error in call +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/fail_call_with_tuple.carbon:21: type error in call // CHECK: expected: (0 = i32, 1 = i32) // CHECK: actual: (0 = (0 = i32, 1 = i32)) - package ExecutableSemanticsTest api; fn f(x: i32, y: i32) -> i32 { return x + y; } diff --git a/executable_semantics/testdata/function/fail_named_params_order.carbon b/executable_semantics/testdata/function/fail_named_params_order.carbon new file mode 100644 index 000000000000..f49481341334 --- /dev/null +++ b/executable_semantics/testdata/function/fail_named_params_order.carbon @@ -0,0 +1,20 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// RUN: not executable_semantics %s 2>&1 | \ +// RUN: FileCheck --match-full-lines --allow-unused-prefixes=false %s +// RUN: not executable_semantics --trace %s 2>&1 | \ +// RUN: FileCheck --match-full-lines --allow-unused-prefixes %s +// AUTOUPDATE: executable_semantics %s +// CHECK: PROGRAM ERROR: {{.*}}/executable_semantics/testdata/function/fail_named_params_order.carbon:14: positional members must come before named members + +package ExecutableSemanticsTest api; + +fn f(x: i32, .d = y: i32, z: i32, .e = a: i32) -> i32 { + return (x + y) - (z + a); +} + +fn main() -> i32 { + return 0; +} diff --git a/executable_semantics/testdata/funptr1.carbon b/executable_semantics/testdata/function/fnty.carbon similarity index 100% rename from executable_semantics/testdata/funptr1.carbon rename to executable_semantics/testdata/function/fnty.carbon diff --git a/executable_semantics/testdata/ignored_parameter.carbon b/executable_semantics/testdata/function/ignored_parameter.carbon similarity index 100% rename from executable_semantics/testdata/ignored_parameter.carbon rename to executable_semantics/testdata/function/ignored_parameter.carbon diff --git a/executable_semantics/testdata/fun3.carbon b/executable_semantics/testdata/function/multiple_args.carbon similarity index 100% rename from executable_semantics/testdata/fun3.carbon rename to executable_semantics/testdata/function/multiple_args.carbon diff --git a/executable_semantics/testdata/fun_named_params.carbon b/executable_semantics/testdata/function/named_params.carbon similarity index 91% rename from executable_semantics/testdata/fun_named_params.carbon rename to executable_semantics/testdata/function/named_params.carbon index 5fe6255a8810..574adc0c2719 100644 --- a/executable_semantics/testdata/fun_named_params.carbon +++ b/executable_semantics/testdata/function/named_params.carbon @@ -11,7 +11,9 @@ package ExecutableSemanticsTest api; -fn f(x: i32, .d = y: i32) => x + y; +fn f(x: i32, .d = y: i32) -> i32 { + return x + y; +} fn main() -> i32 { return f(1, .d = 2) - 3; diff --git a/executable_semantics/testdata/fun2.carbon b/executable_semantics/testdata/function/param_lifetime.carbon similarity index 100% rename from executable_semantics/testdata/fun2.carbon rename to executable_semantics/testdata/function/param_lifetime.carbon diff --git a/executable_semantics/testdata/fun_recur.carbon b/executable_semantics/testdata/function/recursive.carbon similarity index 100% rename from executable_semantics/testdata/fun_recur.carbon rename to executable_semantics/testdata/function/recursive.carbon diff --git a/executable_semantics/testdata/fun1.carbon b/executable_semantics/testdata/function/return.carbon similarity index 100% rename from executable_semantics/testdata/fun1.carbon rename to executable_semantics/testdata/function/return.carbon diff --git a/executable_semantics/testdata/type_match.carbon b/executable_semantics/testdata/function/type_match.carbon similarity index 100% rename from executable_semantics/testdata/type_match.carbon rename to executable_semantics/testdata/function/type_match.carbon diff --git a/executable_semantics/testdata/generic_function_apply.carbon b/executable_semantics/testdata/generic_function/apply.carbon similarity index 100% rename from executable_semantics/testdata/generic_function_apply.carbon rename to executable_semantics/testdata/generic_function/apply.carbon diff --git a/executable_semantics/testdata/generic_function_fail3.carbon b/executable_semantics/testdata/generic_function/fail_not_addable.carbon similarity index 82% rename from executable_semantics/testdata/generic_function_fail3.carbon rename to executable_semantics/testdata/generic_function/fail_not_addable.carbon index d347bd2f195e..2abcd9b72017 100644 --- a/executable_semantics/testdata/generic_function_fail3.carbon +++ b/executable_semantics/testdata/generic_function/fail_not_addable.carbon @@ -7,11 +7,10 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/generic_function_fail3.carbon:18: type error in addition(1) +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_function/fail_not_addable.carbon:17: type error in addition(1) // CHECK: expected: i32 // CHECK: actual: T - package ExecutableSemanticsTest api; fn id[T:! Type](x: T) -> T { diff --git a/executable_semantics/testdata/generic_function_fail1.carbon b/executable_semantics/testdata/generic_function/fail_type_deduction_mismatch.carbon similarity index 80% rename from executable_semantics/testdata/generic_function_fail1.carbon rename to executable_semantics/testdata/generic_function/fail_type_deduction_mismatch.carbon index 8a62cf7d026b..bedec9a98d4d 100644 --- a/executable_semantics/testdata/generic_function_fail1.carbon +++ b/executable_semantics/testdata/generic_function/fail_type_deduction_mismatch.carbon @@ -7,11 +7,10 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/generic_function_fail1.carbon:22: type error in argument deduction +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_function/fail_type_deduction_mismatch.carbon:21: type error in argument deduction // CHECK: expected: i32 // CHECK: actual: Bool - package ExecutableSemanticsTest api; fn fst[T:! Type](x: T, y: T) -> T { diff --git a/executable_semantics/testdata/generic_function_fail2.carbon b/executable_semantics/testdata/generic_function/fail_type_deduction_unused.carbon similarity index 77% rename from executable_semantics/testdata/generic_function_fail2.carbon rename to executable_semantics/testdata/generic_function/fail_type_deduction_unused.carbon index 3321bb8a210a..0206f5a06219 100644 --- a/executable_semantics/testdata/generic_function_fail2.carbon +++ b/executable_semantics/testdata/generic_function/fail_type_deduction_unused.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/generic_function_fail2.carbon:20: could not deduce type argument for type parameter T - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_function/fail_type_deduction_unused.carbon:19: could not deduce type argument for type parameter T package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/generic_function3.carbon b/executable_semantics/testdata/generic_function/non_generic_param.carbon similarity index 100% rename from executable_semantics/testdata/generic_function3.carbon rename to executable_semantics/testdata/generic_function/non_generic_param.carbon diff --git a/executable_semantics/testdata/generic_function1.carbon b/executable_semantics/testdata/generic_function/return_val.carbon similarity index 100% rename from executable_semantics/testdata/generic_function1.carbon rename to executable_semantics/testdata/generic_function/return_val.carbon diff --git a/executable_semantics/testdata/generic_function_swap.carbon b/executable_semantics/testdata/generic_function/swap.carbon similarity index 100% rename from executable_semantics/testdata/generic_function_swap.carbon rename to executable_semantics/testdata/generic_function/swap.carbon diff --git a/executable_semantics/testdata/generic_function_tuple_map.carbon b/executable_semantics/testdata/generic_function/tuple_map.carbon similarity index 100% rename from executable_semantics/testdata/generic_function_tuple_map.carbon rename to executable_semantics/testdata/generic_function/tuple_map.carbon diff --git a/executable_semantics/testdata/generic_function2.carbon b/executable_semantics/testdata/generic_function/type_matching.carbon similarity index 100% rename from executable_semantics/testdata/generic_function2.carbon rename to executable_semantics/testdata/generic_function/type_matching.carbon diff --git a/executable_semantics/testdata/global_variable8.carbon b/executable_semantics/testdata/global_variable/fail_init_order.carbon similarity index 84% rename from executable_semantics/testdata/global_variable8.carbon rename to executable_semantics/testdata/global_variable/fail_init_order.carbon index e8de448604c4..6c1a5deeeb9c 100644 --- a/executable_semantics/testdata/global_variable8.carbon +++ b/executable_semantics/testdata/global_variable/fail_init_order.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: RUNTIME ERROR: {{.*}}/global_variable8.carbon:18: could not find `y` - +// CHECK: RUNTIME ERROR: {{.*}}/executable_semantics/testdata/global_variable/fail_init_order.carbon:17: could not find `y` package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/global_variable3.carbon b/executable_semantics/testdata/global_variable/fail_init_type_mismatch.carbon similarity index 81% rename from executable_semantics/testdata/global_variable3.carbon rename to executable_semantics/testdata/global_variable/fail_init_type_mismatch.carbon index 0fb730d24cf3..1bc3dba302a2 100644 --- a/executable_semantics/testdata/global_variable3.carbon +++ b/executable_semantics/testdata/global_variable/fail_init_type_mismatch.carbon @@ -7,11 +7,10 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/global_variable3.carbon:19: type error in initializer of variable +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/global_variable/fail_init_type_mismatch.carbon:18: type error in initializer of variable // CHECK: expected: i32 // CHECK: actual: Bool - package ExecutableSemanticsTest api; // Test type checking of global variable. Error expected. diff --git a/executable_semantics/testdata/global_variable1.carbon b/executable_semantics/testdata/global_variable/init_and_read.carbon similarity index 100% rename from executable_semantics/testdata/global_variable1.carbon rename to executable_semantics/testdata/global_variable/init_and_read.carbon diff --git a/executable_semantics/testdata/global_variable7.carbon b/executable_semantics/testdata/global_variable/init_from_function.carbon similarity index 100% rename from executable_semantics/testdata/global_variable7.carbon rename to executable_semantics/testdata/global_variable/init_from_function.carbon diff --git a/executable_semantics/testdata/global_variable6.carbon b/executable_semantics/testdata/global_variable/init_order.carbon similarity index 100% rename from executable_semantics/testdata/global_variable6.carbon rename to executable_semantics/testdata/global_variable/init_order.carbon diff --git a/executable_semantics/testdata/global_variable5.carbon b/executable_semantics/testdata/global_variable/shadowing.carbon similarity index 84% rename from executable_semantics/testdata/global_variable5.carbon rename to executable_semantics/testdata/global_variable/shadowing.carbon index 11f4321a5d83..761e949d77ef 100644 --- a/executable_semantics/testdata/global_variable5.carbon +++ b/executable_semantics/testdata/global_variable/shadowing.carbon @@ -7,11 +7,10 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/global_variable5.carbon:22: type error in return +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/global_variable/shadowing.carbon:21: type error in return // CHECK: expected: () // CHECK: actual: i32 - package ExecutableSemanticsTest api; // Test overshadowing of global variable. diff --git a/executable_semantics/testdata/global_variable4.carbon b/executable_semantics/testdata/global_variable/write.carbon similarity index 100% rename from executable_semantics/testdata/global_variable4.carbon rename to executable_semantics/testdata/global_variable/write.carbon diff --git a/executable_semantics/testdata/global_variable2.carbon b/executable_semantics/testdata/global_variable/write_from_function.carbon similarity index 100% rename from executable_semantics/testdata/global_variable2.carbon rename to executable_semantics/testdata/global_variable/write_from_function.carbon diff --git a/executable_semantics/testdata/if_else.carbon b/executable_semantics/testdata/if_else/if_else.carbon similarity index 100% rename from executable_semantics/testdata/if_else.carbon rename to executable_semantics/testdata/if_else/if_else.carbon diff --git a/executable_semantics/testdata/if_else_if.carbon b/executable_semantics/testdata/if_else/if_else_if.carbon similarity index 100% rename from executable_semantics/testdata/if_else_if.carbon rename to executable_semantics/testdata/if_else/if_else_if.carbon diff --git a/executable_semantics/testdata/if_else_if_else.carbon b/executable_semantics/testdata/if_else/if_else_if_else.carbon similarity index 100% rename from executable_semantics/testdata/if_else_if_else.carbon rename to executable_semantics/testdata/if_else/if_else_if_else.carbon diff --git a/executable_semantics/testdata/if_false.carbon b/executable_semantics/testdata/if_else/if_false.carbon similarity index 100% rename from executable_semantics/testdata/if_false.carbon rename to executable_semantics/testdata/if_else/if_false.carbon diff --git a/executable_semantics/testdata/if_nesting.carbon b/executable_semantics/testdata/if_else/if_nesting.carbon similarity index 100% rename from executable_semantics/testdata/if_nesting.carbon rename to executable_semantics/testdata/if_else/if_nesting.carbon diff --git a/executable_semantics/testdata/if_true.carbon b/executable_semantics/testdata/if_else/if_true.carbon similarity index 100% rename from executable_semantics/testdata/if_true.carbon rename to executable_semantics/testdata/if_else/if_true.carbon diff --git a/executable_semantics/testdata/import_nonexistent_library.carbon b/executable_semantics/testdata/import/fail_nonexistent_library.carbon similarity index 91% rename from executable_semantics/testdata/import_nonexistent_library.carbon rename to executable_semantics/testdata/import/fail_nonexistent_library.carbon index 44c6d2085320..eaa1576e0831 100644 --- a/executable_semantics/testdata/import_nonexistent_library.carbon +++ b/executable_semantics/testdata/import/fail_nonexistent_library.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: This SHOULD fail but doesn't presently. +// // RUN: executable_semantics %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes=false %s // RUN: executable_semantics --trace %s 2>&1 | \ diff --git a/executable_semantics/testdata/import_nonexistent_package.carbon b/executable_semantics/testdata/import/fail_nonexistent_package.carbon similarity index 92% rename from executable_semantics/testdata/import_nonexistent_package.carbon rename to executable_semantics/testdata/import/fail_nonexistent_package.carbon index eafa9359d2df..8d68d55ca0d0 100644 --- a/executable_semantics/testdata/import_nonexistent_package.carbon +++ b/executable_semantics/testdata/import/fail_nonexistent_package.carbon @@ -2,6 +2,8 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: This SHOULD fail but doesn't presently. +// // RUN: executable_semantics %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes=false %s // RUN: executable_semantics --trace %s 2>&1 | \ diff --git a/executable_semantics/testdata/import_late.carbon b/executable_semantics/testdata/import/fail_order.carbon similarity index 79% rename from executable_semantics/testdata/import_late.carbon rename to executable_semantics/testdata/import/fail_order.carbon index d4dd763f75cf..e7c182aa65f4 100644 --- a/executable_semantics/testdata/import_late.carbon +++ b/executable_semantics/testdata/import/fail_order.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/import_late.carbon:19: syntax error, unexpected IMPORT, expecting END_OF_FILE - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/import/fail_order.carbon:18: syntax error, unexpected IMPORT, expecting END_OF_FILE package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/match_any_int.carbon b/executable_semantics/testdata/match/any_int.carbon similarity index 100% rename from executable_semantics/testdata/match_any_int.carbon rename to executable_semantics/testdata/match/any_int.carbon diff --git a/executable_semantics/testdata/match_int.carbon b/executable_semantics/testdata/match/int.carbon similarity index 100% rename from executable_semantics/testdata/match_int.carbon rename to executable_semantics/testdata/match/int.carbon diff --git a/executable_semantics/testdata/match_int_default.carbon b/executable_semantics/testdata/match/int_default.carbon similarity index 100% rename from executable_semantics/testdata/match_int_default.carbon rename to executable_semantics/testdata/match/int_default.carbon diff --git a/executable_semantics/testdata/no_match.carbon b/executable_semantics/testdata/match/no_match.carbon similarity index 100% rename from executable_semantics/testdata/no_match.carbon rename to executable_semantics/testdata/match/no_match.carbon diff --git a/executable_semantics/testdata/match_placeholder.carbon b/executable_semantics/testdata/match/placeholder.carbon similarity index 100% rename from executable_semantics/testdata/match_placeholder.carbon rename to executable_semantics/testdata/match/placeholder.carbon diff --git a/executable_semantics/testdata/package_missing.carbon b/executable_semantics/testdata/package/fail_missing.carbon similarity index 77% rename from executable_semantics/testdata/package_missing.carbon rename to executable_semantics/testdata/package/fail_missing.carbon index b8e1e1af644f..85123adbc2f2 100644 --- a/executable_semantics/testdata/package_missing.carbon +++ b/executable_semantics/testdata/package/fail_missing.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/package_missing.carbon:13: syntax error, unexpected FN, expecting PACKAGE - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/package/fail_missing.carbon:12: syntax error, unexpected FN, expecting PACKAGE fn main() -> i32 { return 0; diff --git a/executable_semantics/testdata/package_library.carbon b/executable_semantics/testdata/package/with_library.carbon similarity index 100% rename from executable_semantics/testdata/package_library.carbon rename to executable_semantics/testdata/package/with_library.carbon diff --git a/executable_semantics/testdata/return_empty_explicit.carbon b/executable_semantics/testdata/return/explicit_empty.carbon similarity index 100% rename from executable_semantics/testdata/return_empty_explicit.carbon rename to executable_semantics/testdata/return/explicit_empty.carbon diff --git a/executable_semantics/testdata/return_auto.carbon b/executable_semantics/testdata/return/fail_auto.carbon similarity index 82% rename from executable_semantics/testdata/return_auto.carbon rename to executable_semantics/testdata/return/fail_auto.carbon index 7ba06582a02b..53c378132199 100644 --- a/executable_semantics/testdata/return_auto.carbon +++ b/executable_semantics/testdata/return/fail_auto.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/return_auto.carbon:15: syntax error, unexpected AUTO - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/return/fail_auto.carbon:14: syntax error, unexpected AUTO package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/return_empty_implicit_fail1.carbon b/executable_semantics/testdata/return/fail_explicit_with_no_return.carbon similarity index 72% rename from executable_semantics/testdata/return_empty_implicit_fail1.carbon rename to executable_semantics/testdata/return/fail_explicit_with_no_return.carbon index 5dff75012eda..8514008f377a 100644 --- a/executable_semantics/testdata/return_empty_implicit_fail1.carbon +++ b/executable_semantics/testdata/return/fail_explicit_with_no_return.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/return_empty_implicit_fail1.carbon:16: control-flow reaches end of function that provides a `->` return type without reaching a return statement - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/return/fail_explicit_with_no_return.carbon:15: control-flow reaches end of function that provides a `->` return type without reaching a return statement package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/return_empty_implicit_fail2.carbon b/executable_semantics/testdata/return/fail_explicit_with_plain_return.carbon similarity index 75% rename from executable_semantics/testdata/return_empty_implicit_fail2.carbon rename to executable_semantics/testdata/return/fail_explicit_with_plain_return.carbon index a8f825e7cba7..2445f54a9f92 100644 --- a/executable_semantics/testdata/return_empty_implicit_fail2.carbon +++ b/executable_semantics/testdata/return/fail_explicit_with_plain_return.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/return_empty_implicit_fail2.carbon:16: return; should provide a return value, to match the function's signature. - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/return/fail_explicit_with_plain_return.carbon:15: return; should provide a return value, to match the function's signature. package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/return_empty_explicit_fail.carbon b/executable_semantics/testdata/return/fail_implicit_with_explicit_return.carbon similarity index 74% rename from executable_semantics/testdata/return_empty_explicit_fail.carbon rename to executable_semantics/testdata/return/fail_implicit_with_explicit_return.carbon index 24972f5ffb10..c20e6d34eed6 100644 --- a/executable_semantics/testdata/return_empty_explicit_fail.carbon +++ b/executable_semantics/testdata/return/fail_implicit_with_explicit_return.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/return_empty_explicit_fail.carbon:16: return (); should not provide a return value, to match the function's signature. - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/return/fail_implicit_with_explicit_return.carbon:15: return (); should not provide a return value, to match the function's signature. package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/return_empty_implicit1.carbon b/executable_semantics/testdata/return/implicit_with_no_return.carbon similarity index 100% rename from executable_semantics/testdata/return_empty_implicit1.carbon rename to executable_semantics/testdata/return/implicit_with_no_return.carbon diff --git a/executable_semantics/testdata/return_empty_implicit2.carbon b/executable_semantics/testdata/return/implicit_with_plain_return.carbon similarity index 100% rename from executable_semantics/testdata/return_empty_implicit2.carbon rename to executable_semantics/testdata/return/implicit_with_plain_return.carbon diff --git a/executable_semantics/testdata/string1.carbon b/executable_semantics/testdata/string/basic.carbon similarity index 100% rename from executable_semantics/testdata/string1.carbon rename to executable_semantics/testdata/string/basic.carbon diff --git a/executable_semantics/testdata/string_fail3.carbon b/executable_semantics/testdata/string/fail_hex_lower.carbon similarity index 80% rename from executable_semantics/testdata/string_fail3.carbon rename to executable_semantics/testdata/string/fail_hex_lower.carbon index b77ffba067bd..8456c75da6ef 100644 --- a/executable_semantics/testdata/string_fail3.carbon +++ b/executable_semantics/testdata/string/fail_hex_lower.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/string_fail3.carbon:16: Invalid escaping in string: "str\xaa" - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/string/fail_hex_lower.carbon:15: Invalid escaping in string: "str\xaa" package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/string_fail2.carbon b/executable_semantics/testdata/string/fail_hex_truncated.carbon similarity index 80% rename from executable_semantics/testdata/string_fail2.carbon rename to executable_semantics/testdata/string/fail_hex_truncated.carbon index c214552ae9bf..972b1437debf 100644 --- a/executable_semantics/testdata/string_fail2.carbon +++ b/executable_semantics/testdata/string/fail_hex_truncated.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/string_fail2.carbon:16: Invalid escaping in string: "str\x" - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/string/fail_hex_truncated.carbon:15: Invalid escaping in string: "str\x" package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/string_fail1.carbon b/executable_semantics/testdata/string/fail_invalid_escape.carbon similarity index 80% rename from executable_semantics/testdata/string_fail1.carbon rename to executable_semantics/testdata/string/fail_invalid_escape.carbon index 040ff097f577..ea97a7b189d9 100644 --- a/executable_semantics/testdata/string_fail1.carbon +++ b/executable_semantics/testdata/string/fail_invalid_escape.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/string_fail1.carbon:16: Invalid escaping in string: "str\e" - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/string/fail_invalid_escape.carbon:15: Invalid escaping in string: "str\e" package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/string_fail5.carbon b/executable_semantics/testdata/string/fail_newline.carbon similarity index 80% rename from executable_semantics/testdata/string_fail5.carbon rename to executable_semantics/testdata/string/fail_newline.carbon index fb092a9a249d..35f75ca2b58d 100644 --- a/executable_semantics/testdata/string_fail5.carbon +++ b/executable_semantics/testdata/string/fail_newline.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/string_fail5.carbon:16: invalid character '\x22' in source file. - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/string/fail_newline.carbon:15: invalid character '\x22' in source file. package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/string_fail4.carbon b/executable_semantics/testdata/string/fail_octal.carbon similarity index 80% rename from executable_semantics/testdata/string_fail4.carbon rename to executable_semantics/testdata/string/fail_octal.carbon index 163627f25c9c..c1930344c2d4 100644 --- a/executable_semantics/testdata/string_fail4.carbon +++ b/executable_semantics/testdata/string/fail_octal.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/string_fail4.carbon:16: Invalid escaping in string: "str\01" - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/string/fail_octal.carbon:15: Invalid escaping in string: "str\01" package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/string_fail6.carbon b/executable_semantics/testdata/string/fail_tab.carbon similarity index 81% rename from executable_semantics/testdata/string_fail6.carbon rename to executable_semantics/testdata/string/fail_tab.carbon index 152a0d92c7eb..511a27c5c6a8 100644 --- a/executable_semantics/testdata/string_fail6.carbon +++ b/executable_semantics/testdata/string/fail_tab.carbon @@ -7,8 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/string_fail6.carbon:16: Invalid escaping in string: "new line" - +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/string/fail_tab.carbon:15: Invalid escaping in string: "new line" package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/string3.carbon b/executable_semantics/testdata/string/hex.carbon similarity index 100% rename from executable_semantics/testdata/string3.carbon rename to executable_semantics/testdata/string/hex.carbon diff --git a/executable_semantics/testdata/string2.carbon b/executable_semantics/testdata/string/newline.carbon similarity index 100% rename from executable_semantics/testdata/string2.carbon rename to executable_semantics/testdata/string/newline.carbon diff --git a/executable_semantics/testdata/tuple_assign.carbon b/executable_semantics/testdata/tuple/assign.carbon similarity index 100% rename from executable_semantics/testdata/tuple_assign.carbon rename to executable_semantics/testdata/tuple/assign.carbon diff --git a/executable_semantics/testdata/tuple2.carbon b/executable_semantics/testdata/tuple/ending_comma.carbon similarity index 100% rename from executable_semantics/testdata/tuple2.carbon rename to executable_semantics/testdata/tuple/ending_comma.carbon diff --git a/executable_semantics/testdata/tuple_equality.carbon b/executable_semantics/testdata/tuple/equality.carbon similarity index 100% rename from executable_semantics/testdata/tuple_equality.carbon rename to executable_semantics/testdata/tuple/equality.carbon diff --git a/executable_semantics/testdata/tuple_equality2.carbon b/executable_semantics/testdata/tuple/equality_false.carbon similarity index 100% rename from executable_semantics/testdata/tuple_equality2.carbon rename to executable_semantics/testdata/tuple/equality_false.carbon diff --git a/executable_semantics/testdata/tuple_equality3.carbon b/executable_semantics/testdata/tuple/fail_equality_type.carbon similarity index 81% rename from executable_semantics/testdata/tuple_equality3.carbon rename to executable_semantics/testdata/tuple/fail_equality_type.carbon index c86edb49b810..2a812b5a68c0 100644 --- a/executable_semantics/testdata/tuple_equality3.carbon +++ b/executable_semantics/testdata/tuple/fail_equality_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // RUN: not executable_semantics %s 2>&1 2>&1 | FileCheck %s +// AUTOUPDATE: executable_semantics %s +// CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/tuple/fail_equality_type.carbon:16: type error in == +// CHECK: expected: (0 = i32, 1 = i32) +// CHECK: actual: (0 = i32) package ExecutableSemanticsTest api; @@ -15,8 +19,3 @@ fn main() -> i32 { return 0; } } - -// AUTOUPDATE: executable_semantics %s -// CHECK: COMPILATION ERROR: {{.*}}/tuple_equality3.carbon:12: type error in == -// CHECK: expected: (0 = i32, 1 = i32) -// CHECK: actual: (0 = i32) diff --git a/executable_semantics/testdata/tuple5.carbon b/executable_semantics/testdata/tuple/fail_name_order.carbon similarity index 80% rename from executable_semantics/testdata/tuple5.carbon rename to executable_semantics/testdata/tuple/fail_name_order.carbon index 53eba00a67c1..8f65f52f819c 100644 --- a/executable_semantics/testdata/tuple5.carbon +++ b/executable_semantics/testdata/tuple/fail_name_order.carbon @@ -7,7 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: PROGRAM ERROR: {{.*}}/tuple5.carbon:17: Tuple field name 'y' does not match pattern field name 'x' +// CHECK: PROGRAM ERROR: {{.*}}/executable_semantics/testdata/tuple/fail_name_order.carbon:17: Tuple field name 'y' does not match pattern field name 'x' package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/tuple4.carbon b/executable_semantics/testdata/tuple/fail_positional_order.carbon similarity index 79% rename from executable_semantics/testdata/tuple4.carbon rename to executable_semantics/testdata/tuple/fail_positional_order.carbon index 832b8628a5aa..7f87a04129b4 100644 --- a/executable_semantics/testdata/tuple4.carbon +++ b/executable_semantics/testdata/tuple/fail_positional_order.carbon @@ -7,7 +7,7 @@ // RUN: not executable_semantics --trace %s 2>&1 | \ // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s // AUTOUPDATE: executable_semantics %s -// CHECK: PROGRAM ERROR: {{.*}}/tuple4.carbon:15: positional members must come before named members +// CHECK: PROGRAM ERROR: {{.*}}/executable_semantics/testdata/tuple/fail_positional_order.carbon:15: positional members must come before named members package ExecutableSemanticsTest api; diff --git a/executable_semantics/testdata/tuple_match.carbon b/executable_semantics/testdata/tuple/match.carbon similarity index 100% rename from executable_semantics/testdata/tuple_match.carbon rename to executable_semantics/testdata/tuple/match.carbon diff --git a/executable_semantics/testdata/tuple_match3.carbon b/executable_semantics/testdata/tuple/match_nested.carbon similarity index 100% rename from executable_semantics/testdata/tuple_match3.carbon rename to executable_semantics/testdata/tuple/match_nested.carbon diff --git a/executable_semantics/testdata/tuple_match2.carbon b/executable_semantics/testdata/tuple/match_with_named.carbon similarity index 100% rename from executable_semantics/testdata/tuple_match2.carbon rename to executable_semantics/testdata/tuple/match_with_named.carbon diff --git a/executable_semantics/testdata/tuple3.carbon b/executable_semantics/testdata/tuple/named.carbon similarity index 100% rename from executable_semantics/testdata/tuple3.carbon rename to executable_semantics/testdata/tuple/named.carbon diff --git a/executable_semantics/testdata/tuple1.carbon b/executable_semantics/testdata/tuple/no_ending_comma.carbon similarity index 100% rename from executable_semantics/testdata/tuple1.carbon rename to executable_semantics/testdata/tuple/no_ending_comma.carbon diff --git a/executable_semantics/testdata/while1.carbon b/executable_semantics/testdata/while/basic.carbon similarity index 100% rename from executable_semantics/testdata/while1.carbon rename to executable_semantics/testdata/while/basic.carbon diff --git a/executable_semantics/testdata/break1.carbon b/executable_semantics/testdata/while/break.carbon similarity index 100% rename from executable_semantics/testdata/break1.carbon rename to executable_semantics/testdata/while/break.carbon diff --git a/executable_semantics/testdata/continue1.carbon b/executable_semantics/testdata/while/continue.carbon similarity index 100% rename from executable_semantics/testdata/continue1.carbon rename to executable_semantics/testdata/while/continue.carbon diff --git a/executable_semantics/update_checks.py b/executable_semantics/update_checks.py index e88a8705dc14..86ed7f4a81be 100755 --- a/executable_semantics/update_checks.py +++ b/executable_semantics/update_checks.py @@ -24,30 +24,28 @@ _AUTOUPDATE_MARKER = "// AUTOUPDATE: executable_semantics %s\n" def _get_tests(): """Get the list of tests from the filesystem.""" tests = set() - for path in list(os.listdir(_TESTDATA)): - f = os.path.basename(path) - if f == "lit.cfg": - # Ignore the lit config. - continue - basename, ext = os.path.splitext(f) - if ext == ".carbon": - tests.add(basename) - else: - sys.exit("Unrecognized file type in testdata: %s" % f) + for root, _, files in os.walk(_TESTDATA): + for f in files: + if f == "lit.cfg": + # Ignore the lit config. + continue + if os.path.splitext(f)[1] == ".carbon": + tests.add(os.path.join(root, f)) + else: + sys.exit("Unrecognized file type in testdata: %s" % f) return tests def _update_check(test): """Updates the CHECK: lines for `test` by running executable_semantics.""" - test_file = "%s/%s.carbon" % (_TESTDATA, test) - with open(test_file) as f: + with open(test) as f: orig_lines = f.readlines() if _AUTOUPDATE_MARKER not in orig_lines: - raise ValueError("No autoupdate marker in %s" % test_file) + raise ValueError("No autoupdate marker in %s" % test) # Run executable_semantics to general output. # (`bazel run` would serialize) p = subprocess.run( - ["%s/executable_semantics" % _BINDIR, test_file], + ["%s/executable_semantics" % _BINDIR, test], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, ) @@ -57,7 +55,7 @@ def _update_check(test): # when used. # TODO: Maybe revisit and see if lit can be convinced to give a # root-relative path. - out = out.replace(test_file, "{{.*}}/%s.carbon" % test) + out = out.replace(test, "{{.*}}/%s" % test) # Remove old OUT. lines_without_check = [ @@ -65,7 +63,7 @@ def _update_check(test): ] autoupdate_index = lines_without_check.index(_AUTOUPDATE_MARKER) assert autoupdate_index >= 0 - with open(test_file, "w") as f: + with open(test, "w") as f: f.writelines(lines_without_check[: autoupdate_index + 1]) f.writelines(["// CHECK: %s\n" % x for x in out.splitlines()]) f.writelines(lines_without_check[autoupdate_index + 1 :])