use of org.nutz.lang.segment.Segment in project nutz by nutzam.
the class CharSegmentTest method testThreePoints.
@Test
public void testThreePoints() {
Segment seg = Segments.create("A${1}B${1}C${2}D");
seg.set("1", "$p1");
seg.set("2", "$p2");
assertEquals("A$p1B$p1C$p2D", seg.toString());
assertEquals(2, seg.keys().size());
assertEquals(7, seg.values().size());
}
use of org.nutz.lang.segment.Segment in project nutz by nutzam.
the class CharSegmentTest method testClone.
@Test
public void testClone() {
Segment seg = Segments.create("A${a}B");
seg.set("a", "A");
assertEquals("AAB", seg.toString());
Segment seg2 = (CharSegment) seg.clone();
seg.set("a", "FF");
assertEquals("AAB", seg2.toString());
assertEquals("AFFB", seg.toString());
}
use of org.nutz.lang.segment.Segment in project nutz by nutzam.
the class CharSegmentTest method testLackLeftBracket.
@Test
public void testLackLeftBracket() {
Segment seg = Segments.create("H$4}B");
assertEquals("H$4}B", seg.toString());
assertEquals(0, seg.keys().size());
assertEquals(1, seg.values().size());
}
use of org.nutz.lang.segment.Segment in project nutz by nutzam.
the class CharSegmentTest method testCloseDynamicMark_E1.
@Test
public void testCloseDynamicMark_E1() {
Segment seg = Segments.create("A${1}}}B");
seg.set("1", "T1");
assertEquals("AT1}}B", seg.toString());
}
use of org.nutz.lang.segment.Segment in project nutz by nutzam.
the class CharSegmentTest method testEscapeChar.
@Test
public void testEscapeChar() {
Segment seg = Segments.create("H$$4}B");
assertEquals("H$4}B", seg.toString());
assertEquals(0, seg.keys().size());
assertEquals(1, seg.values().size());
}
Aggregations