From dd463e8dd436b10dc175c86b687f86f9448a05ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9sar=20Sagaert?= Date: Mon, 17 Mar 2025 12:28:48 +0100 Subject: [PATCH] feat: add .gitignore to `alr init`-generated test crate (#1894) --- src/alr/alr-commands-init.adb | 10 ++++++++++ testsuite/tests/workflows/init-options/test.py | 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/alr/alr-commands-init.adb b/src/alr/alr-commands-init.adb index 8a03570a..c076676a 100644 --- a/src/alr/alr-commands-init.adb +++ b/src/alr/alr-commands-init.adb @@ -397,6 +397,16 @@ package body Alr.Commands.Init is Put_Line ("end " & Test_Upper & ";"); TIO.Close (File); + if not Create (+Full_Name (Test_Directory / ".gitignore")) then + Trace.Warning ("Could not create .gitignore for test crate"); + return; + end if; + Put_Line ("/obj/"); + Put_Line ("/bin/"); + Put_Line ("/alire/"); + Put_Line ("/config/"); + TIO.Close (File); + Test_Srcs.Make_Dir; if not Create (+Full_Name (Test_Srcs / (+Test_Lower & "-example_test.adb"))) then Trace.Warning ("Could not create example test in 'tests/src'"); diff --git a/testsuite/tests/workflows/init-options/test.py b/testsuite/tests/workflows/init-options/test.py index 4d63c704..312dd962 100644 --- a/testsuite/tests/workflows/init-options/test.py +++ b/testsuite/tests/workflows/init-options/test.py @@ -36,6 +36,7 @@ compare(contents('xxx'), ['xxx/.gitignore', 'xxx/src', 'xxx/src/xxx.adb', 'xxx/tests', + 'xxx/tests/.gitignore', 'xxx/tests/alire.toml', 'xxx/tests/common', 'xxx/tests/common/xxx_tests.ads', @@ -63,6 +64,7 @@ compare(contents('aaa'), ['aaa/.gitignore', 'aaa/src', 'aaa/src/aaa.adb', 'aaa/tests', + 'aaa/tests/.gitignore', 'aaa/tests/aaa_tests.gpr', 'aaa/tests/alire.toml', 'aaa/tests/common', @@ -131,6 +133,7 @@ compare(contents('.'), ['./.gitignore', './src', './src/zzz.adb', './tests', + './tests/.gitignore', './tests/alire.toml', './tests/common', './tests/common/zzz_tests.ads', -- 2.39.5