@@ -0,0 +1,1569 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public%0A * License, v. 2.0. If a copy of the MPL was not distributed with this%0A * file, You can obtain one at http://mozilla.org/MPL/2.0/. */%0Apackage org.mozilla.javascript.tests;%0A%0Aimport org.junit.*;%0Aimport org.mozilla.javascript.CompilerEnvirons;%0Aimport org.mozilla.javascript.Parser;%0Aimport org.mozilla.javascript.ast.AstNode;%0Aimport org.mozilla.javascript.ast.AstRoot;%0Aimport org.mozilla.javascript.ast.Comment;%0A%0Aimport java.util.SortedSet;%0A%0Aimport static org.junit.Assert.*;%0A%0A/**%0A * Tests position of Comment node in source code.%0A */%0Apublic class Issue533Test %7B%0A    private static final String SOURCE_URI = %22issue533test.js%22;%0A%0A    private Parser parser;%0A%0A    @Before%0A    public void setUp() %7B%0A        CompilerEnvirons compilerEnv = new CompilerEnvirons();%0A        compilerEnv.setRecordingComments(true);%0A        parser = new Parser(compilerEnv);%0A    %7D%0A%0A    @Test%0A    public void testGetPosition() %7B%0A        String script = %22function a() %7B%5Cn    //testtest%5Cn   function b() %7B%5Cn        //password%5Cn    %7D%5Cn%7D%22;%0A        AstRoot root = parser.parse(script, SOURCE_URI, 0);%0A        SortedSet%3CComment%3E comments = root.getComments();%0A        assertEquals(2, comments.size());%0A        for(Comment comment:comments) %7B%0A            assertEquals(comment.getValue(), getFromSource(script, comment));                    %0A        %7D%0A    %7D%0A%0A    private String getFromSource(String source, AstNode node) %7B%0A        return source.substring(node.getAbsolutePosition(), node.getAbsolutePosition() + node.getLength());%0A    %7D%0A%7D%0A

test for #533