Skip to content

Instantly share code, notes, and snippets.

@haint
Created June 11, 2012 04:08
Show Gist options
  • Save haint/2908478 to your computer and use it in GitHub Desktop.
Save haint/2908478 to your computer and use it in GitHub Desktop.
Less importing relative relationship testcase
commit 87393b51d2c199ac7d00621c9b0fc52f86e9ae9d
Author: haint <haithanh0809@gmail.com>
Date: Mon Jun 11 10:54:00 2012 +0700
Less importing relative relationship testcase
diff --git a/plugins/less/src/test/java/juzu/plugin/less/LesserTestCase.java b/plugins/less/src/test/java/juzu/plugin/less/LesserTestCase.java
index 370f381..441906d 100644
--- a/plugins/less/src/test/java/juzu/plugin/less/LesserTestCase.java
+++ b/plugins/less/src/test/java/juzu/plugin/less/LesserTestCase.java
@@ -99,6 +99,19 @@ public class LesserTestCase {
" width: 2px;\n" +
"}\n", compilation.getValue());
}
+
+ @Test
+ public void testImportRelative() throws Exception {
+ URLLessContext context = new URLLessContext(LesserTestCase.class.getClassLoader().getResource("lesser/test/relative/"));
+ Failure failure = (Failure)lesser.compile(context, "entry.less");
+ LinkedList<LessError> errors = failure.getErrors();
+ Assert.assertEquals(1, errors.size());
+ LessError error = errors.get(0);
+ Assert.assertEquals(1, error.line);
+ Assert.assertEquals(4, error.column);
+ Assert.assertEquals(4, error.index);
+ Assert.assertEquals("Parse", error.type);
+ }
@Test
public void testUnresolableVariable() throws Exception {
diff --git a/plugins/less/src/test/resources/lesser/test/relative/entry.less b/plugins/less/src/test/resources/lesser/test/relative/entry.less
new file mode 100644
index 0000000..67fd38c
--- /dev/null
+++ b/plugins/less/src/test/resources/lesser/test/relative/entry.less
@@ -0,0 +1 @@
+@import "importer.less";
\ No newline at end of file
diff --git a/plugins/less/src/test/resources/lesser/test/relative/foo/bar/imported.less b/plugins/less/src/test/resources/lesser/test/relative/foo/bar/imported.less
new file mode 100644
index 0000000..5098a5c
--- /dev/null
+++ b/plugins/less/src/test/resources/lesser/test/relative/foo/bar/imported.less
@@ -0,0 +1 @@
+a { width: 1+1px; }
\ No newline at end of file
diff --git a/plugins/less/src/test/resources/lesser/test/relative/foo/importer.less b/plugins/less/src/test/resources/lesser/test/relative/foo/importer.less
new file mode 100644
index 0000000..737e7fe
--- /dev/null
+++ b/plugins/less/src/test/resources/lesser/test/relative/foo/importer.less
@@ -0,0 +1 @@
+@import "bar/imported.less";
\ No newline at end of file
diff --git a/plugins/less/src/test/resources/lesser/test/relative/importer.less b/plugins/less/src/test/resources/lesser/test/relative/importer.less
new file mode 100644
index 0000000..cfc0a83
--- /dev/null
+++ b/plugins/less/src/test/resources/lesser/test/relative/importer.less
@@ -0,0 +1 @@
+@import "foo/importer.less";
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment