hey, guys, I want to use unit test, so I add aunit
with alr with aunit
and this is my project
the tests/test_math.adb
with AUnit; use AUnit;
with AUnit.Test_Cases; use AUnit.Test_Cases;
with Ada.Text_IO;
package Test_Math is
procedure TestHello;
end Test_Math;
package body Test_Math is
package StdIO renames Ada.Text_IO;
procedure TestHello is
begin
StdIO.Put_Line ("Hello World");
Assert ( 1 = 1, "Fuck");
end TestHello;
end Test_Math;
the tests/run_tests.adb
,(this is the test entry)
with AUnit.Run;
with Test_Math;
procedure RunTests is
procedure Run is new AUnit.Run.Test_Runner(Test_Math.TestHello);
begin
Run;
end RunTests;
but I don’t know how to launch the tests, I have already modify the project gpr file like this
project Ada_Example is
for Source_Dirs use ("src/", "config/", "tests/"); -- modify here, add the "tests/"
for Object_Dir use "obj/" & Ada_Example_Config.Build_Profile;
for Create_Missing_Dirs use "True";
for Exec_Dir use "bin";
for Main use ("ada_example.adb");
package Compiler is
for Default_Switches ("Ada") use Ada_Example_Config.Ada_Compiler_Switches;
end Compiler;
package Binder is
for Switches ("Ada") use ("-Es"); -- Symbolic traceback
end Binder;
package Install is
for Artifacts (".") use ("share");
end Install;
end Ada_Example;
and this is the toml file
name = "ada_example"
description = ""
version = "0.1.0-dev"
authors = ["steiner"]
maintainers = ["steiner <steiner3044@163.com>"]
maintainers-logins = ["steiner"]
licenses = "MIT OR Apache-2.0 WITH LLVM-exception"
website = ""
tags = []
executables = ["ada_example", "run_tests"] -- modify here, add "run_tests"
[[depends-on]]
aunit = "^25.0.0"
still cannot find the run_tests
executable
steiner@macbook /V/a/w/ada_example> alr run --list (base)
Crate ada_example builds these executables:
ada_example (found at /Volumes/apple-extended/workspace/ada_example/bin/ada_example)
run_tests (not found)
I don’t know how to fix it, can you help me out ?