use of org.nutz.lang.segment.Segment in project nutz by nutzam.
the class CharSegmentTest method testTwoPoints.
@Test
public void testTwoPoints() {
Segment seg = Segments.create("A${1}B${2}C");
seg.set("1", "$p1");
seg.set("2", "$p2");
assertEquals("A$p1B$p2C", seg.toString());
assertEquals(2, seg.keys().size());
assertEquals(5, seg.values().size());
}
use of org.nutz.lang.segment.Segment in project nutz by nutzam.
the class CharSegmentTest method testAddPP1.
@Test
public void testAddPP1() {
Segment seg = Segments.create("-${A}-");
seg.add("A", "A");
seg.add("A", "B");
seg.add("A", "C");
assertEquals("-ABC-", seg.toString());
seg.set("A", "HH");
assertEquals("-HH-", seg.toString());
}
use of org.nutz.lang.segment.Segment in project nutz by nutzam.
the class CharSegmentTest method testKeys.
@Test
public void testKeys() {
Segment seg = Segments.create("-${A}-${B}-${A}-${B}-");
assertEquals(2, seg.keys().size());
seg.set("A", "[a]");
seg.set("B", "[b]");
assertEquals("-[a]-[b]-[a]-[b]-", seg.toString());
}
use of org.nutz.lang.segment.Segment in project nutz by nutzam.
the class CharSegmentTest method testBorn.
@Test
public void testBorn() {
Segment seg = Segments.create("A${a}B");
seg.set("a", "A");
assertEquals("AAB", seg.toString());
Segment seg2 = (CharSegment) seg.born();
assertEquals("AB", seg2.toString());
assertEquals("AAB", seg.toString());
}
use of org.nutz.lang.segment.Segment in project nutz by nutzam.
the class CharSegmentTest method testTrueFalse.
@Test
public void testTrueFalse() {
Segment seg = Segments.create("true:[${true}]\tfalse:[${false}]");
seg.set("true", true);
seg.set("false", false);
assertEquals("true:[true]\tfalse:[false]", seg.toString());
}
Aggregations