Search in sources :

Example 6 with ParseResult

use of com.google.javascript.jscomp.parsing.ParserRunner.ParseResult in project closure-compiler by google.

the class ParserTest method testParseInlineSourceMap.

public void testParseInlineSourceMap() {
    String code = "var X = (function () {\n" + "    function X(input) {\n" + "        this.y = input;\n" + "    }\n" + "    return X;\n" + "}());\n" + "console.log(new X(1));\n" + "//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpz" + "Iiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZm9vLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU" + "FBO0lBR0UsV0FBWSxLQUFhO1FBQ3ZCLElBQUksQ0FBQyxDQUFDLEdBQUcsS0FBSyxDQUFDO0lBQ2pCLENBQUM7" + "SUFDSCxRQUFDO0FBQUQsQ0FBQyxBQU5ELElBTUM7QUFFRCxPQUFPLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQy" + "xDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMifQ==";
    ParseResult result = doParse(code);
    assertThat(result.sourceMapURL).isEqualTo("data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpz" + "Iiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZm9vLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU" + "FBO0lBR0UsV0FBWSxLQUFhO1FBQ3ZCLElBQUksQ0FBQyxDQUFDLEdBQUcsS0FBSyxDQUFDO0lBQ2pCLENBQUM7" + "SUFDSCxRQUFDO0FBQUQsQ0FBQyxBQU5ELElBTUM7QUFFRCxPQUFPLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQy" + "xDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMifQ==");
}
Also used : ParseResult(com.google.javascript.jscomp.parsing.ParserRunner.ParseResult)

Aggregations

ParseResult (com.google.javascript.jscomp.parsing.ParserRunner.ParseResult)6 Node (com.google.javascript.rhino.Node)2 NodeSubject.assertNode (com.google.javascript.jscomp.testing.NodeSubject.assertNode)1 SimpleSourceFile (com.google.javascript.rhino.SimpleSourceFile)1 TestErrorReporter (com.google.javascript.rhino.testing.TestErrorReporter)1