use of org.nutz.lang.segment.Segment in project nutz by nutzam.
the class CharSegmentTest method testTwoSamePoints.
@Test
public void testTwoSamePoints() {
Segment seg = Segments.create("A${1}B${1}C");
seg.set("1", "$p1");
assertEquals("A$p1B$p1C", seg.toString());
assertEquals(1, seg.keys().size());
assertEquals(5, seg.values().size());
}
use of org.nutz.lang.segment.Segment in project nutz by nutzam.
the class CharSegmentTest method testAddPP3.
@Test
public void testAddPP3() {
Segment seg = Segments.create("-${A}-${B}-");
Segment sub = Segments.create("[${V}]");
Segment sub2 = Segments.create("%${V}%");
seg.add("A", sub);
seg.add("A", sub2);
seg.set("B", "***");
sub.set("V", "#");
sub2.set("V", "@");
assertEquals("-[#]%@%-***-", seg.toString());
seg.set("B", "ZZH");
assertEquals("-[#]%@%-ZZH-", seg.toString());
}
use of org.nutz.lang.segment.Segment in project nutz by nutzam.
the class CharSegmentTest method testClearAll.
@Test
public void testClearAll() {
Segment seg = Segments.create("A${1}B${1}C${2}D");
seg.set("1", "T1");
seg.set("2", "T2");
seg.clearAll();
assertEquals("ABCD", seg.toString());
}
use of org.nutz.lang.segment.Segment in project nutz by nutzam.
the class CharSegmentTest method testAtTheEnd.
@Test
public void testAtTheEnd() {
Segment seg = Segments.create("H${4}");
seg.set("4", "zzh");
assertEquals("Hzzh", seg.toString());
assertEquals(1, seg.keys().size());
assertEquals(2, seg.values().size());
}
use of org.nutz.lang.segment.Segment in project nutz by nutzam.
the class CharSegmentTest method testEscapeChar2.
@Test
public void testEscapeChar2() {
Segment seg = Segments.create("H$$$4}B");
assertEquals("H$$4}B", seg.toString());
}
Aggregations