From 48096b49053f83c2897280cda6b529da78c7c58b Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Sat, 9 Nov 2024 15:14:30 -0500 Subject: [PATCH 1/2] Tests for annotated string/char c-tors --- test/strings/annotated.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/strings/annotated.jl b/test/strings/annotated.jl index 85acab74abf7b..c00b73c6d00fa 100644 --- a/test/strings/annotated.jl +++ b/test/strings/annotated.jl @@ -68,6 +68,10 @@ "AnnotatedString{String}(\"some string\", [(1:4, :thing, 0x01), (6:11, :other, 0x02), (1:11, :all, 0x03)])" @test eval(Meta.parse(repr(str))) == str @test sprint(show, MIME("text/plain"), str) == "\"some string\"" + + a = Base.AnnotatedString("hello", :label => 1) + b = Base.AnnotatedString("hello", [(1:5, :label, 1)]) + @test a == b end @testset "AnnotatedChar" begin @@ -84,6 +88,10 @@ end @test str[1] == Base.AnnotatedChar('h', [(:attr, "h0h0")]) @test str[2] == Base.AnnotatedChar('m', [(:attr, "h0m1"), (:attr, "m1m2")]) @test str[3] == Base.AnnotatedChar('m', [(:attr, "m1m2")]) + + a = Base.AnnotatedChar('h' , :label => 1) + b = Base.AnnotatedChar('h', [(1:1, :label, 1)]) + @test a == b end @testset "Styling preservation" begin From 725050913c5dda9c8f8fa6cb0a154033e579a566 Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Fri, 15 Nov 2024 11:46:49 -0500 Subject: [PATCH 2/2] fix test --- test/strings/annotated.jl | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/test/strings/annotated.jl b/test/strings/annotated.jl index c00b73c6d00fa..475085b0146ab 100644 --- a/test/strings/annotated.jl +++ b/test/strings/annotated.jl @@ -69,9 +69,8 @@ @test eval(Meta.parse(repr(str))) == str @test sprint(show, MIME("text/plain"), str) == "\"some string\"" - a = Base.AnnotatedString("hello", :label => 1) - b = Base.AnnotatedString("hello", [(1:5, :label, 1)]) - @test a == b + a = Base.AnnotatedString("hello", [(1:5, :label, 1)]) + @test first(a) == Base.AnnotatedChar('h', [(:label, 1)]) end @testset "AnnotatedChar" begin @@ -88,10 +87,6 @@ end @test str[1] == Base.AnnotatedChar('h', [(:attr, "h0h0")]) @test str[2] == Base.AnnotatedChar('m', [(:attr, "h0m1"), (:attr, "m1m2")]) @test str[3] == Base.AnnotatedChar('m', [(:attr, "m1m2")]) - - a = Base.AnnotatedChar('h' , :label => 1) - b = Base.AnnotatedChar('h', [(1:1, :label, 1)]) - @test a == b end @testset "Styling preservation" begin