From 5878af87ec4e9ff6e745a977f7864c66063bd9c7 Mon Sep 17 00:00:00 2001 From: Alejandro R Mosteo Date: Sun, 16 Mar 2025 00:34:40 +0100 Subject: [PATCH] fix: enable assertions in test crate (#1902) --- src/alr/alr-commands-init.adb | 1 + testsuite/tests/test/default-failure/test.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/alr/alr-commands-init.adb b/src/alr/alr-commands-init.adb index e255624e..8a03570a 100644 --- a/src/alr/alr-commands-init.adb +++ b/src/alr/alr-commands-init.adb @@ -370,6 +370,7 @@ package body Alr.Commands.Init is Put_New_Line; Put_Line ("[build-profiles]"); Put_Line (Lower_Name & " = 'validation'"); + Put_Line (Test_Lower & " = 'validation'"); TIO.Close (File); if not Create (+Full_Name (Test_Directory / (+Test_Lower & ".gpr"))) then diff --git a/testsuite/tests/test/default-failure/test.py b/testsuite/tests/test/default-failure/test.py index a24be703..e9f400d0 100644 --- a/testsuite/tests/test/default-failure/test.py +++ b/testsuite/tests/test/default-failure/test.py @@ -9,6 +9,8 @@ from drivers.asserts import assert_match init_local_crate("xxx", with_test=True) +# Check with explicit exception + with open("./tests/src/xxx_tests-example_test.adb", "w") as f: f.write("""procedure Xxx_Tests.Example_Test is begin @@ -19,4 +21,16 @@ end Xxx_Tests.Example_Test; p = run_alr("test", complain_on_error=False) assert_match(".*\[ FAIL \] example_test.*", p.out) +# Check with plain assertion (verify that assertions are evaluated) + +with open("./tests/src/xxx_tests-example_test.adb", "w") as f: + f.write("""procedure Xxx_Tests.Example_Test is +begin + pragma Assert (False); +end Xxx_Tests.Example_Test; +""") + +p = run_alr("test", complain_on_error=False) +assert_match(".*\[ FAIL \] example_test.*", p.out) + print('SUCCESS') -- 2.39.5