From 8eefa0445e0fbc6c9efe346e1d179bfc4a9c4e3c Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Wed, 11 Dec 2024 15:45:07 +0100 Subject: [PATCH] Add a test covering the highlighting of non-contiguous spans --- .../test/multiple_highlight_test.dart | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkgs/source_span/test/multiple_highlight_test.dart b/pkgs/source_span/test/multiple_highlight_test.dart index 139d53c8a4..92ad569fe9 100644 --- a/pkgs/source_span/test/multiple_highlight_test.dart +++ b/pkgs/source_span/test/multiple_highlight_test.dart @@ -44,6 +44,22 @@ gibble bibble bop '""")); }); + test('highlights non contiguous spans', () { + expect( + file.span(17, 21).highlightMultiple( + 'one', {file.span(60, 66): 'two', file.span(4, 7): 'three'}), + equals(""" + , +1 | foo bar baz + | === three +2 | whiz bang boom + | ^^^^ one +... | +5 | argle bargle boo + | ====== two + '""")); + }); + test('highlights spans on the same line', () { expect( file.span(17, 21).highlightMultiple(