Index: tests/natools-s_expressions-cache_tests.adb ================================================================== --- tests/natools-s_expressions-cache_tests.adb +++ tests/natools-s_expressions-cache_tests.adb @@ -115,11 +115,11 @@ Print_Info (Pool); Flush; end Info_Pool; begin declare - Cache : Debug_Caches.Reference; + Cache, Deep, Shallow : Debug_Caches.Reference; begin Inject_Test (Cache); declare First : Debug_Caches.Cursor := Cache.First; @@ -128,10 +128,24 @@ begin Output.Set_Expected (Canonical_Test); Printers.Transfer (First, Pr); Output.Check_Stream (Test); end; + + Deep := Cache.Duplicate; + Shallow := Deep; + Deep.Append_Atom (To_Atom ("more")); + + declare + Other : Debug_Caches.Cursor := Deep.First; + Output : aliased Test_Tools.Memory_Stream; + Pr : Printers.Canonical (Output'Access); + begin + Output.Set_Expected (Canonical_Test & To_Atom ("4:more")); + Printers.Transfer (Other, Pr); + Output.Check_Stream (Test); + end; declare Second : Debug_Caches.Cursor := Cache.First; Output : aliased Test_Tools.Memory_Stream; Pr : Printers.Canonical (Output'Access); @@ -138,10 +152,20 @@ begin Output.Set_Expected (Canonical_Test); Printers.Transfer (Second, Pr); Output.Check_Stream (Test); end; + + declare + Second_Other : Debug_Caches.Cursor := Shallow.First; + Output : aliased Test_Tools.Memory_Stream; + Pr : Printers.Canonical (Output'Access); + begin + Output.Set_Expected (Canonical_Test & To_Atom ("4:more")); + Printers.Transfer (Second_Other, Pr); + Output.Check_Stream (Test); + end; end; Info_Pool; exception when Error : others => Test.Report_Exception (Error); @@ -150,11 +174,11 @@ procedure Default_Instantiation (Report : in out NT.Reporter'Class) is Test : NT.Test := Report.Item ("Default instantiation"); begin declare - Cache : Caches.Reference; + Cache, Deep, Shallow : Caches.Reference; begin Inject_Test (Cache); declare First : Caches.Cursor := Cache.First; @@ -163,10 +187,24 @@ begin Output.Set_Expected (Canonical_Test); Printers.Transfer (First, Pr); Output.Check_Stream (Test); end; + + Deep := Cache.Duplicate; + Shallow := Deep; + Deep.Append_Atom (To_Atom ("more")); + + declare + Other : Caches.Cursor := Deep.First; + Output : aliased Test_Tools.Memory_Stream; + Pr : Printers.Canonical (Output'Access); + begin + Output.Set_Expected (Canonical_Test & To_Atom ("4:more")); + Printers.Transfer (Other, Pr); + Output.Check_Stream (Test); + end; declare Second : Caches.Cursor := Cache.First; Output : aliased Test_Tools.Memory_Stream; Pr : Printers.Canonical (Output'Access); @@ -173,11 +211,21 @@ begin Output.Set_Expected (Canonical_Test); Printers.Transfer (Second, Pr); Output.Check_Stream (Test); end; + + declare + Second_Other : Caches.Cursor := Shallow.First; + Output : aliased Test_Tools.Memory_Stream; + Pr : Printers.Canonical (Output'Access); + begin + Output.Set_Expected (Canonical_Test & To_Atom ("4:more")); + Printers.Transfer (Second_Other, Pr); + Output.Check_Stream (Test); + end; end; exception when Error : others => Test.Report_Exception (Error); end Default_Instantiation; end Natools.S_Expressions.Cache_Tests;