mirror of
https://github.com/corda/corda.git
synced 2025-01-20 03:36:29 +00:00
Add a unit test for regular expressions
We do not really support regular expressions yet, but we do support trivial patterns including ones with escaped characters. Let's make sure that that works as advertised. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
parent
728473e9ad
commit
359f99c0f7
@ -105,6 +105,15 @@ public class Strings {
|
||||
(prematureEOS ? "\u00ae\ufffd" : "\u00ae\uaeaf"));
|
||||
}
|
||||
|
||||
public static void testTrivialPattern() throws Exception {
|
||||
expect("?7".matches("\\0777"));
|
||||
expect("\007".matches("\\a"));
|
||||
expect("\\".matches("\\\\"));
|
||||
expect("J".matches("\\x4A"));
|
||||
expect("a".matches("\\x61"));
|
||||
expect("\0078".matches("\\078"));
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
expect(new String(new byte[] { 99, 111, 109, 46, 101, 99, 111, 118, 97,
|
||||
116, 101, 46, 110, 97, 116, 46, 98, 117,
|
||||
@ -193,5 +202,7 @@ public class Strings {
|
||||
32, 110, 117, 116, 115 },
|
||||
System.getProperty("line.separator").getBytes())));
|
||||
}
|
||||
|
||||
testTrivialPattern();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user