Package com.google.gwt.i18n.server.MessageFormatUtils

Examples of com.google.gwt.i18n.server.MessageFormatUtils.TemplateChunk


  public void testParseLiteral() throws ParseException {
    String str = "Simple string literal";
    List<TemplateChunk> parsed = MessageStyle.MESSAGE_FORMAT.parse(str);
    assertEquals(1, parsed.size());
    TemplateChunk chunk = parsed.get(0);
    assertTrue(chunk.isLiteral());
    assertEquals(str, chunk.getString());
  }
View Full Code Here


  public void testParseNestedQuoting() throws ParseException {
    String str = "'Don''t worry about nested quotes'";
    List<TemplateChunk> parsed = MessageStyle.MESSAGE_FORMAT.parse(str);
    assertEquals(1, parsed.size());
    TemplateChunk chunk = parsed.get(0);
    assertTrue(chunk.isLiteral());
    assertEquals("Don't worry about nested quotes", chunk.getString());
  }
View Full Code Here

  public void testParseQuoting() throws ParseException {
    String str = "Don''t replace '{0}' or '{'0'}'";
    List<TemplateChunk> parsed = MessageStyle.MESSAGE_FORMAT.parse(str);
    assertEquals(1, parsed.size());
    TemplateChunk chunk = parsed.get(0);
    assertTrue(chunk.isLiteral());
    assertEquals("Don't replace {0} or {0}", chunk.getString());
  }
View Full Code Here

  public void testParseSimple1() throws ParseException {
    String str = "{0}";
    List<TemplateChunk> parsed = MessageStyle.MESSAGE_FORMAT.parse(str);
    assertEquals(1, parsed.size());
    TemplateChunk chunk = parsed.get(0);
    assertFalse(chunk.isLiteral());
    assertEquals("{0}", chunk.getString());
    ArgumentChunk argChunk = (ArgumentChunk) chunk;
    assertEquals(0, argChunk.getArgumentNumber());
    assertNull(argChunk.getFormat());
    assertNull(argChunk.getSubFormat());
  }
View Full Code Here

  public void testParseSimple2() throws ParseException {
    String str = "Message {0} has one arg, '{0}'";
    List<TemplateChunk> parsed = MessageStyle.MESSAGE_FORMAT.parse(str);
    assertEquals(3, parsed.size());
    TemplateChunk chunk = parsed.get(0);
    assertTrue(chunk.isLiteral());
    assertEquals("Message ", chunk.getString());
    chunk = parsed.get(1);
    assertFalse(chunk.isLiteral());
    assertEquals("{0}", chunk.getString());
    ArgumentChunk argChunk = (ArgumentChunk) chunk;
    assertEquals(0, argChunk.getArgumentNumber());
    assertNull(argChunk.getFormat());
    assertNull(argChunk.getSubFormat());
    chunk = parsed.get(2);
    assertTrue(chunk.isLiteral());
    assertEquals(" has one arg, {0}", chunk.getString());
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.i18n.server.MessageFormatUtils.TemplateChunk

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.