Package com.google.debugging.sourcemap

Examples of com.google.debugging.sourcemap.SourceMapConsumerV1$SourceFile$Builder


    sb.append("['test.js', 0, 1]\n");
    sb.append("['bleg.js', 5, 8, 'hello']\n");
    sb.append("['bleg.js', 12, 78]\n");
    sb.append("['foo.js', 15, 16, 'yo!']");

    SourceMapConsumerV1 sourceMap = new SourceMapConsumerV1();
    sourceMap.parse(sb.toString());

    OriginalMapping mapping = sourceMap.getMappingForLine(1, 1);

    assertNotNull(mapping);
    assertEquals("test.js", mapping.getOriginalFile());
    assertEquals(0, mapping.getLineNumber());
    assertEquals(1, mapping.getColumnPosition());
    assertEquals("", mapping.getIdentifier());

    mapping = sourceMap.getMappingForLine(1, 6);
    assertNotNull(mapping);
    assertEquals("bleg.js", mapping.getOriginalFile());
    assertEquals(5, mapping.getLineNumber());
    assertEquals(8, mapping.getColumnPosition());
    assertEquals("hello", mapping.getIdentifier());

    mapping = sourceMap.getMappingForLine(2, 4);
    assertNotNull(mapping);
    assertEquals("foo.js", mapping.getOriginalFile());
    assertEquals(15, mapping.getLineNumber());
    assertEquals(16, mapping.getColumnPosition());
    assertEquals("yo!", mapping.getIdentifier());

    assertNull(sourceMap.getMappingForLine(Integer.MAX_VALUE, 1));
    assertNotNull(sourceMap.getMappingForLine(1, Integer.MAX_VALUE));
  }
View Full Code Here


    sb.append("/** Begin mapping definitions. **/\n");
    for (int i = 0; i <= 200; i++) {
      sb.append("['foo.js', ").append(i).append(", 1]\n");
    }

    SourceMapConsumerV1 sourceMap = new SourceMapConsumerV1();
    sourceMap.parse(sb.toString());

    OriginalMapping mapping = sourceMap.getMappingForLine(-1, 1);
    assertNull(mapping);

    mapping = sourceMap.getMappingForLine(0, 1);
    assertNull(mapping);

    mapping = sourceMap.getMappingForLine(1, 1);
    assertEquals(100, mapping.getLineNumber());

    mapping = sourceMap.getMappingForLine(2, 1);
    assertEquals(200, mapping.getLineNumber());

    mapping = sourceMap.getMappingForLine(3, 1);
    assertNull(mapping);
  }
View Full Code Here

    sb.append("/** Begin mapping definitions. **/\n");
    for (int i = 0; i <= 200; i++) {
      sb.append("['foo.js', ").append(i).append(", 1]\n");
    }

    SourceMapConsumerV1 sourceMap = new SourceMapConsumerV1();
    sourceMap.parse(sb.toString());

    OriginalMapping mapping = sourceMap.getMappingForLine(1, -1);
    assertNull(mapping);

    mapping = sourceMap.getMappingForLine(1, 0);
    assertNull(mapping);

    mapping = sourceMap.getMappingForLine(1, 1);
    assertEquals(100, mapping.getLineNumber());

    mapping = sourceMap.getMappingForLine(1, 2);
    assertEquals(101, mapping.getLineNumber());

    // Columns beyond the end of the line are treated the same
    // as the last column.
    mapping = sourceMap.getMappingForLine(1, 3);
    assertEquals(101, mapping.getLineNumber());
  }
View Full Code Here

    sb.append("/** Begin mapping definitions. **/\n");
    for (int i = 0; i <= 200; i++) {
      sb.append("['foo.js', 1, ").append(i).append("]\n");
    }

    SourceMapConsumerV1 sourceMap = new SourceMapConsumerV1();
    sourceMap.parse(sb.toString());

    OriginalMapping mapping = sourceMap.getMappingForLine(1, 2);
    assertNull(mapping);

    mapping = sourceMap.getMappingForLine(1, 4);
    assertNull(mapping);
  }
View Full Code Here

    sb.append("/** Begin mapping definitions. **/\n");
    sb.append("['test.js', 0, 1]\n");
    sb.append("['test.js', 0, 1, 'hello']\n");
    sb.append("['test.js', 0, 1]");

    SourceMapConsumerV1 sourceMap = new SourceMapConsumerV1();
    sourceMap.parse(sb.toString());
  }
View Full Code Here

    sb.append("\n");
    sb.append("/** Begin file information. **/\n");
    sb.append("\n");
    sb.append("/** Begin mapping definitions. **/\n");

    SourceMapConsumerV1 sourceMap = new SourceMapConsumerV1();
    sourceMap.parse(sb.toString());
  }
View Full Code Here

    for (int i = 0; i < 262; i++) {
      sb.append("['frog/test" + i + ".js', " + i + ", 1]\n");
    }
    sb.append("['frog/testigloo.js', 500, 1]");

    SourceMapConsumerV1 sourceMap = new SourceMapConsumerV1();
    sourceMap.parse(sb.toString());

    OriginalMapping mapping = sourceMap.getMappingForLine(1, 1);

    assertNotNull(mapping);
    assertEquals("frog/test0.js", mapping.getOriginalFile());
    assertEquals(0, mapping.getLineNumber());
    assertEquals(1, mapping.getColumnPosition());
    assertEquals("", mapping.getIdentifier());

    mapping = sourceMap.getMappingForLine(1, 6);
    assertNotNull(mapping);
    assertEquals("frog/test261.js", mapping.getOriginalFile());
    assertEquals(261, mapping.getLineNumber());
    assertEquals(1, mapping.getColumnPosition());
  }
View Full Code Here

    for (int i = 0; i < 2000; i++) {
      sb.append("['frog/test" + (i / 100) + ".js', " + i + ", 1]\n");
    }
    sb.append("['frog/testigloo.js', 500, 1]");

    SourceMapConsumerV1 sourceMap = new SourceMapConsumerV1();
    sourceMap.parse(sb.toString());

    OriginalMapping mapping = sourceMap.getMappingForLine(1, 1);

    assertNotNull(mapping);
    assertEquals("frog/test0.js", mapping.getOriginalFile());
    assertEquals(0, mapping.getLineNumber());
    assertEquals(1, mapping.getColumnPosition());
    assertEquals("", mapping.getIdentifier());

    mapping = sourceMap.getMappingForLine(1, 6);
    assertNotNull(mapping);
    assertEquals("frog/test2.js", mapping.getOriginalFile());
    assertEquals(261, mapping.getLineNumber());
    assertEquals(1, mapping.getColumnPosition());

    mapping = sourceMap.getMappingForLine(1, 8);
    assertNotNull(mapping);
    assertEquals("frog/test10.js", mapping.getOriginalFile());
    assertEquals(1023, mapping.getLineNumber());
    assertEquals(1, mapping.getColumnPosition());
  }
View Full Code Here

  private void assertException(String exception, StringBuilder sb) {
    boolean exceptionRaised = false;

    try {
      SourceMapConsumerV1 sourceMap = new SourceMapConsumerV1();
      sourceMap.parse(sb.toString());

    } catch (SourceMapParseException pe) {
      assertEquals(exception, pe.getMessage());
      exceptionRaised = true;
    }
View Full Code Here

  private void assertExceptionStartsWith(String exception, StringBuilder sb) {
    boolean exceptionRaised = false;

    try {
      SourceMapConsumerV1 sourceMap = new SourceMapConsumerV1();
      sourceMap.parse(sb.toString());

    } catch (SourceMapParseException pe) {
      assertTrue(
        "expected <" + exception +"> but was <"+ pe.getMessage() +">",
        pe.getMessage().startsWith(exception));
View Full Code Here

TOP

Related Classes of com.google.debugging.sourcemap.SourceMapConsumerV1$SourceFile$Builder

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.