Package org.nutz.lang.segment

Examples of org.nutz.lang.segment.Segment


import org.nutz.lang.segment.Segment;

public class CharSegmentTest {
  @Test
  public void testNormal() {
    Segment seg = Segments.create("H${4}B");
    seg.set("4", "zzh");
    assertEquals("H${4}B", seg.getOrginalString());
    assertEquals("HzzhB", seg.toString());
    assertEquals(1, seg.keys().size());
    assertEquals(3, seg.values().size());
  }
View Full Code Here


    assertEquals(3, seg.values().size());
  }

  @Test
  public void testWrongPPname() {
    Segment seg = Segments.create("H${4}B");
    seg.set("RVT", "zzh");
    assertEquals("HB", seg.toString());
    seg.set("4", "zzh");
    assertEquals("HzzhB", seg.toString());
    assertEquals(1, seg.keys().size());
    assertEquals(3, seg.values().size());
  }
View Full Code Here

    Segments.create("H${4");
  }

  @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());
  }
View Full Code Here

    assertEquals(1, seg.values().size());
  }

  @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());
  }
View Full Code Here

    assertEquals(1, seg.values().size());
  }

  @Test
  public void testEscapeChar2() {
    Segment seg = Segments.create("H$$$4}B");
    assertEquals("H$$4}B", seg.toString());
  }
View Full Code Here

    assertEquals("H$$4}B", seg.toString());
  }

  @Test
  public void testEscapeChar3() {
    Segment seg = Segments.create("H$$$$4}B");
    assertEquals("H$$4}B", seg.toString());
  }
View Full Code Here

    assertEquals("H$$4}B", seg.toString());
  }

  @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());
  }
View Full Code Here

    assertEquals(2, seg.values().size());
  }

  @Test
  public void testAtTheBegin() {
    Segment seg = Segments.create("${4}B");
    seg.set("4", "zzh");
    assertEquals("zzhB", seg.toString());
    assertEquals(1, seg.keys().size());
    assertEquals(2, seg.values().size());
  }
View Full Code Here

    assertEquals(2, seg.values().size());
  }

  @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());
  }
View Full Code Here

    assertEquals(5, seg.values().size());
  }

  @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());
  }
View Full Code Here

TOP

Related Classes of org.nutz.lang.segment.Segment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.