Search in sources :

Example 6 with CompilationResult

use of org.apache.sling.scripting.sightly.compiler.CompilationResult in project sling by apache.

the class SightlyCompilerTest method testErrorReporting1.

@Test
public void testErrorReporting1() {
    String script = "/error-1.html";
    CompilationResult result = compile(script);
    List<CompilerMessage> errors = result.getErrors();
    assertTrue("Expected compilation errors.", errors.size() == 1);
    CompilerMessage error = errors.get(0);
    assertEquals("Error is not reported at the expected line.", 18, error.getLine());
}
Also used : CompilerMessage(org.apache.sling.scripting.sightly.compiler.CompilerMessage) CompilationResult(org.apache.sling.scripting.sightly.compiler.CompilationResult) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

CompilationResult (org.apache.sling.scripting.sightly.compiler.CompilationResult)6 CompilerMessage (org.apache.sling.scripting.sightly.compiler.CompilerMessage)5 Test (org.junit.Test)3 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)3 File (java.io.File)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Bindings (javax.script.Bindings)1 ScriptException (javax.script.ScriptException)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1 SlingBindings (org.apache.sling.api.scripting.SlingBindings)1 ScriptNameAware (org.apache.sling.scripting.api.ScriptNameAware)1 SightlyException (org.apache.sling.scripting.sightly.SightlyException)1 CompilationUnit (org.apache.sling.scripting.sightly.compiler.CompilationUnit)1 SightlyCompiler (org.apache.sling.scripting.sightly.compiler.SightlyCompiler)1 SourceIdentifier (org.apache.sling.scripting.sightly.impl.engine.compiled.SourceIdentifier)1 GlobalShadowCheckBackendCompiler (org.apache.sling.scripting.sightly.java.compiler.GlobalShadowCheckBackendCompiler)1 JavaClassBackendCompiler (org.apache.sling.scripting.sightly.java.compiler.JavaClassBackendCompiler)1