JAL-4059 updated test for StringUtils
authorBen Soares <b.soares@dundee.ac.uk>
Thu, 2 Nov 2023 23:07:55 +0000 (23:07 +0000)
committerBen Soares <b.soares@dundee.ac.uk>
Thu, 2 Nov 2023 23:07:55 +0000 (23:07 +0000)
test/jalview/util/StringUtilsTest.java

index dc7ed92..1f8e451 100644 (file)
@@ -131,6 +131,15 @@ public class StringUtilsTest
     assertEquals("[hello\\world, jello'\\world', mello'wo\\'rld']",
             Arrays.toString(StringUtils.separatorListToArray(
                     "hello\\world;jello'\\world';mello'wo\\'rld'", ";")));
+    // this next one checks that an escaped single quote doesn't end a quoted
+    // section so the following separator is treated as part of the quoted text,
+    // not as a separator.
+    assertEquals("[hello\\world, jello'\\world', mello'wo\\'r;ld']",
+            Arrays.toString(StringUtils.separatorListToArray(
+                    "hello\\world;jello'\\world';mello'wo\\'r;ld'", ";")));
+    assertEquals("[hello\\;jello, mello\\;';'w, world]",
+            Arrays.toString(StringUtils.separatorListToArray(
+                    "hello\\;jello;mello\\;';'w;world", ";")));
   }
 
   @Test(groups = { "Functional" })