Examples of OriginalMapping


Examples of com.google.debugging.sourcemap.proto.Mapping.OriginalMapping

    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

Examples of com.google.debugging.sourcemap.proto.Mapping.OriginalMapping

    }

    // Map the tokens from the generated source back to the
    // input source and ensure that the map is correct.
    for (Token token : resultTokens.values()) {
      OriginalMapping mapping = reader.getMappingForLine(
          token.position.getLine() + 1,
          token.position.getColumn() + 1);

      assertNotNull(mapping);

      // Find the associated token in the input source.
      Token inputToken = originalTokens.get(token.tokenName);
      assertNotNull(inputToken);
      assertEquals(mapping.getOriginalFile(), inputToken.inputName);

      // Ensure that the map correctly points to the token (we add 1
      // to normalize versus the Rhino line number indexing scheme).
      assertEquals(mapping.getLineNumber(),
                   inputToken.position.getLine() + 1);

      // Ensure that if the token name does not being with an 'STR' (meaning a
      // string) it has an original name.
      if (!inputToken.tokenName.startsWith("STR")) {
        assertTrue("missing name for " + inputToken.tokenName,
            !mapping.getIdentifier().isEmpty());
      }

      // Ensure that if the mapping has a name, it matches the token.
      if (!mapping.getIdentifier().isEmpty()) {
        assertEquals(mapping.getIdentifier(),
            "__" + inputToken.tokenName + "__");
      }
    }
  }
View Full Code Here

Examples of com.google.debugging.sourcemap.proto.Mapping.OriginalMapping

        "}\n";

    SourceMapConsumerV2 sourceMap = new SourceMapConsumerV2();
    sourceMap.parse(mapData);

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

    assertNotNull(mapping);
    assertEquals("testcode", mapping.getOriginalFile());
    assertEquals(1, mapping.getLineNumber());
    assertEquals(9, mapping.getColumnPosition());
    assertEquals("f", mapping.getIdentifier());

    mapping = sourceMap.getMappingForLine(1, 40);

    assertNotNull(mapping);
    assertEquals("testcode", mapping.getOriginalFile());
    assertEquals(1, mapping.getLineNumber());
    assertEquals(44, mapping.getColumnPosition());
    assertEquals("", mapping.getIdentifier());

    mapping = sourceMap.getMappingForLine(1, 42);
    assertNotNull(mapping);
    assertEquals("testcode", mapping.getOriginalFile());
    assertEquals(1, mapping.getLineNumber());
    assertEquals(51, mapping.getColumnPosition());
    assertEquals("foo", mapping.getIdentifier());

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

Examples of com.google.debugging.sourcemap.proto.Mapping.OriginalMapping

        "}\n";

    SourceMapConsumerV2 sourceMap = new SourceMapConsumerV2();
    sourceMap.parse(mapData);

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

    assertNotNull(mapping);
    assertEquals("testcode", mapping.getOriginalFile());
    assertEquals(1, mapping.getLineNumber());
    assertEquals(9, mapping.getColumnPosition());
    assertEquals("f", mapping.getIdentifier());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.