Skip to content

Commit

Permalink
Testcase for issue reported under eng/ide/VSS#256.
Browse files Browse the repository at this point in the history
  • Loading branch information
godunko committed Nov 13, 2024
1 parent 33e0e59 commit 9320866
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions testsuite/text/test_string-test_slice.adb
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,33 @@ begin
R := S1.Slice (JLV, JLV);
Test_Support.Assert (R.Is_Null);
end;

-- Slice of string with last marker pointing to end of string.
--
-- It was reported under eng/ide/VSS#256

declare
use type VSS.Strings.Character_Count;

SS : VSS.Strings.Virtual_String := "body ";
-- Static storage
SR : VSS.Strings.Virtual_String := "package body ";
-- Reported case: static storage of max size on 64bit platform
SD : VSS.Strings.Virtual_String := "package body Name ";
-- Dynamic storage
R : VSS.Strings.Virtual_String;

begin
R := SS.Slice (SS.At_First_Character, SS.After_Last_Character);
Test_Support.Assert (R.Character_Length = SS.Character_Length);
Test_Support.Assert (R = SS);

R := SR.Slice (SR.At_First_Character, SR.After_Last_Character);
Test_Support.Assert (R.Character_Length = SR.Character_Length);
Test_Support.Assert (R = SR);

R := SD.Slice (SD.At_First_Character, SD.After_Last_Character);
Test_Support.Assert (R.Character_Length = SD.Character_Length);
Test_Support.Assert (R = SD);
end;
end Test_Slice;

0 comments on commit 9320866

Please sign in to comment.