Skip to content

Commit

Permalink
Testcase for Virtual_String_Vector.Join with string separator.
Browse files Browse the repository at this point in the history
  • Loading branch information
godunko committed Nov 7, 2024
1 parent cea0fbb commit 3c3156d
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions testsuite/text/test_string_vector.adb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ procedure Test_String_Vector is
-- Testcases

procedure Test_Legacy_Tests;
procedure Test_Join_String;
procedure Test_Join_Lines;
procedure Test_Is_Empty;
procedure Test_Append_Vector;
Expand Down Expand Up @@ -305,6 +306,41 @@ procedure Test_String_Vector is
end;
end Test_Join_Lines;

----------------------
-- Test_Join_String --
----------------------

procedure Test_Join_String is
begin
-- Usual case

declare
V : constant VSS.String_Vectors.Virtual_String_Vector :=
["ABC", "DEF", "GHI"];

begin
Test_Support.Assert (V.Join ("") = "ABCDEFGHI");
Test_Support.Assert (V.Join (",") = "ABC,DEF,GHI");
Test_Support.Assert (V.Join ("=>") = "ABC=>DEF=>GHI");
end;

-- Empty vector

declare
VE : VSS.String_Vectors.Virtual_String_Vector;

begin
Test_Support.Assert (VE.Join ("").Is_Empty);
Test_Support.Assert (VE.Join ("").Is_Null);

Test_Support.Assert (VE.Join (",").Is_Empty);
Test_Support.Assert (VE.Join (",").Is_Null);

Test_Support.Assert (VE.Join ("=>").Is_Empty);
Test_Support.Assert (VE.Join ("=>").Is_Null);
end;
end Test_Join_String;

-----------------------
-- Test_Legacy_Tests --
-----------------------
Expand Down Expand Up @@ -436,6 +472,8 @@ procedure Test_String_Vector is
begin
Test_Support.Run_Testcase
(Test_Legacy_Tests'Access, "Various legacy tests");
Test_Support.Run_Testcase
(Test_Join_String'Access, "Join String Separator");
Test_Support.Run_Testcase (Test_Join_Lines'Access, "Join_Lines");
Test_Support.Run_Testcase (Test_Is_Empty'Access, "Is_Empty");
Test_Support.Run_Testcase (Test_Append_Vector'Access, "Append (Vector)");
Expand Down

0 comments on commit 3c3156d

Please sign in to comment.