@Test @RunAsClient public final void testCopyAsset() throws Exception { CompilerAssert<File, File> compiler = getCompiler(); ReadWriteFileSystem<File> classOutput = compiler.getClassOutput(); File file = classOutput.getPath("plugin", "asset", "location", "applicationrelative", "assets", "test.js"); assertNotNull(file); assertTrue(file.exists()); assertTrue(file.isFile()); } }
@Test @RunAsClient public final void testCopyAsset() throws Exception { CompilerAssert<File, File> compiler = getCompiler(); ReadWriteFileSystem<File> classOutput = compiler.getClassOutput(); File file = classOutput.getPath("plugin", "amd", "aliases", "assets", "foo.js"); assertNotNull(file); assertTrue(file.exists()); assertTrue(file.isFile()); }
@Test @RunAsClient public final void testCopyAsset() throws Exception { CompilerAssert<File, File> compiler = getCompiler(); ReadWriteFileSystem<File> classOutput = compiler.getClassOutput(); File file = classOutput.getPath("plugin", "asset", "location", "defaultrelative", "assets", "test.js"); assertNotNull(file); assertTrue(file.exists()); assertTrue(file.isFile()); } }
@Test @RunAsClient public final void testCopyAsset() throws Exception { CompilerAssert<File, File> compiler = getCompiler(); ReadWriteFileSystem<File> classOutput = compiler.getClassOutput(); File file = classOutput.getPath("plugin", "asset", "location", "defaultrelative", "assets", "test.js"); assertNotNull(file); assertTrue(file.exists()); assertTrue(file.isFile()); } }
@Test public void testAncestor() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less4j.ancestor"); ca.assertCompile(); File f = ca.getClassOutput().getPath("plugin", "less4j", "ancestor", "assets", "folder", "stylesheet.css"); assertNotNull(f); assertTrue(f.exists()); }
@Test public void testBootstrap() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less4j.bootstrap"); ca.assertCompile(); File f = ca.getClassOutput().getPath("plugin", "less4j", "bootstrap", "assets", "bootstrap.css"); assertNotNull(f); assertTrue(f.exists()); }
@Test public void testWebJars() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less4j.webjars"); ca.assertCompile(); File f = ca.getClassOutput().getPath("plugin", "less4j", "webjars", "assets", "bootstrap", "3.1.1", "less", "bootstrap.css"); assertNotNull(f); assertTrue(f.exists()); } }
@Test public void testResolve() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less.resolve"); ca.assertCompile(); File f = ca.getClassOutput().getPath("plugin", "less", "resolve", "assets", "stylesheet.css"); assertNotNull(f); assertTrue(f.exists()); }
@Test public void testAncestor() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less.ancestor"); ca.assertCompile(); File f = ca.getClassOutput().getPath("plugin", "less", "ancestor", "assets", "folder", "stylesheet.css"); assertNotNull(f); assertTrue(f.exists()); } }
@Test public void testAncestor() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less4j.ancestor"); ca.assertCompile(); File f = ca.getClassOutput().getPath("plugin", "less4j", "ancestor", "assets", "folder", "stylesheet.css"); assertNotNull(f); assertTrue(f.exists()); }
@Test public void testCompile() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less4j.compile"); ca.assertCompile(); File f = ca.getClassOutput().getPath("plugin", "less4j", "compile", "assets", "stylesheet.css"); assertNotNull(f); assertTrue(f.exists()); }
@Test public void testMinify() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less.minify"); ca.assertCompile(); File f = ca.getClassOutput().getPath("plugin", "less", "minify", "assets", "stylesheet.css"); assertNotNull(f); assertTrue(f.exists()); String s = Tools.read(f); assertFalse(s.contains(" ")); }
@Test public void testMalformedPath() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less.malformedpath"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(LessMetaModelPlugin.MALFORMED_PATH, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less", "malformedpath", "package-info.java"); assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput().getPath("plugin", "less", "malformedpath", "assets", "stylesheet.css"); assertNull(f); }
@Test public void testMalformedPath() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less.malformedpath"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(LessMetaModelPlugin.MALFORMED_PATH, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less", "malformedpath", "package-info.java"); assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput().getPath("plugin", "less", "malformedpath", "assets", "stylesheet.css"); assertNull(f); }
@Test public void testFail() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less.fail"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(LessMetaModelPlugin.COMPILATION_ERROR, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less", "fail", "package-info.java"); assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput().getPath("plugin", "less", "fail", "assets", "stylesheet.css"); assertNull(f); }
@Test public void testNotFound() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less.notfound"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(LessMetaModelPlugin.COMPILATION_ERROR, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less", "notfound", "package-info.java"); assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput().getPath("plugin", "less", "notfound", "assets", "stylesheet.css"); assertNull(f); }
@Test public void testCannotResolve() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less4j.cannotresolve"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(MetaModelPluginImpl.COMPILATION_ERROR, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less4j", "cannotresolve", "package-info.java"); // assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput().getPath("plugin", "less4j", "cannotresolve", "assets", "stylesheet.css"); assertNull(f); } /*
@Test public void testFail() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less4j.fail"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(MetaModelPluginImpl.COMPILATION_ERROR, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less4j", "fail", "package-info.java"); // assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput().getPath("plugin", "less4j", "fail", "assets", "stylesheet.css"); assertNull(f); }
@Test public void testCannotResolve() throws Exception { CompilerAssert<File, File> ca = compiler("plugin.less4j.cannotresolve"); List<CompilationError> errors = ca.formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); assertEquals(MetaModelPluginImpl.COMPILATION_ERROR, errors.get(0).getCode()); File f = ca.getSourcePath().getPath("plugin", "less4j", "cannotresolve", "package-info.java"); // assertEquals(f, errors.get(0).getSourceFile()); f = ca.getClassOutput().getPath("plugin", "less4j", "cannotresolve", "assets", "stylesheet.css"); assertNull(f); } /*
@Test public void testBuild() throws Exception { CompilerAssert<File, File> helper = incrementalCompiler("metamodel.param"); helper.assertCompile(); // File ser = helper.getSourceOutput().getPath("juzu", "metamodel.ser"); ModuleMetaModel mm = (ModuleMetaModel)Tools.unserialize(MetaModelState.class, ser).metaModel; assertEquals(expectedJSON, mm.toJSON()); }