diff options
author | Henri Sara <hesara@vaadin.com> | 2012-08-09 12:28:47 +0300 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2012-08-09 12:28:47 +0300 |
commit | f0f857817670a0ce95da5178bf86d1725a654eed (patch) | |
tree | 22bd48275c209dffcde1232dd2779a12fd3c6d09 /tests | |
parent | f946e4d34acd05924d136199d58e4cc954ec2cf8 (diff) | |
download | vaadin-framework-f0f857817670a0ce95da5178bf86d1725a654eed.tar.gz vaadin-framework-f0f857817670a0ce95da5178bf86d1725a654eed.zip |
Refactor SASS tests to fail on exceptions (#9223)
Diffstat (limited to 'tests')
19 files changed, 37 insertions, 104 deletions
diff --git a/tests/sass/resources/css/semicolons.css b/tests/sass/resources/css/semicolons.css index 1471ce359a..8a08617638 100644 --- a/tests/sass/resources/css/semicolons.css +++ b/tests/sass/resources/css/semicolons.css @@ -3,6 +3,7 @@ position: absolute; overflow: hidden; } + .missing-semicolon-on-last-row { color: red; background-color: blue; diff --git a/tests/sass/src/com/vaadin/sass/AbstractTestBase.java b/tests/sass/src/com/vaadin/sass/AbstractTestBase.java index f657ac797f..7040eb43a2 100644 --- a/tests/sass/src/com/vaadin/sass/AbstractTestBase.java +++ b/tests/sass/src/com/vaadin/sass/AbstractTestBase.java @@ -6,6 +6,8 @@ import java.io.FileReader; import java.io.IOException; import java.net.URISyntaxException; +import junit.framework.Assert; + import org.w3c.css.sac.CSSException; public abstract class AbstractTestBase { @@ -62,23 +64,21 @@ public abstract class AbstractTestBase { return content.toString(); } - public boolean testParser(String file) throws CSSException, IOException, + public void testParser(String file) throws CSSException, IOException, URISyntaxException { originalScss = getFileContent(file); ScssStylesheet sheet = getStyleSheet(file); parsedScss = sheet.toString(); - return parsedScss.equals(originalScss); + Assert.assertEquals("Original CSS and parsed CSS do not match", + originalScss, parsedScss); } - public boolean testCompiler(String scss, String css) { - try { - comparisonCss = getFileContent(css); - ScssStylesheet sheet = getStyleSheet(scss); - sheet.compile(); - parsedScss = sheet.toString(); - } catch (Exception e) { - return false; - } - return parsedScss.equals(comparisonCss); + public void testCompiler(String scss, String css) throws Exception { + comparisonCss = getFileContent(css); + ScssStylesheet sheet = getStyleSheet(scss); + sheet.compile(); + parsedScss = sheet.toString(); + Assert.assertEquals("Original CSS and parsed CSS do not match", + comparisonCss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/css/EmptyBlock.java b/tests/sass/src/com/vaadin/sass/testcases/css/EmptyBlock.java index 1484c0703e..47613560d8 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/css/EmptyBlock.java +++ b/tests/sass/src/com/vaadin/sass/testcases/css/EmptyBlock.java @@ -3,8 +3,6 @@ package com.vaadin.sass.testcases.css; import java.io.IOException; import java.net.URISyntaxException; -import junit.framework.Assert; - import org.junit.Test; import org.w3c.css.sac.CSSException; @@ -17,7 +15,5 @@ public class EmptyBlock extends AbstractTestBase { public void testParser() throws CSSException, URISyntaxException, IOException { testParser(css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - originalScss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/css/Media.java b/tests/sass/src/com/vaadin/sass/testcases/css/Media.java index b96dc8bc5b..28d33deab0 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/css/Media.java +++ b/tests/sass/src/com/vaadin/sass/testcases/css/Media.java @@ -3,8 +3,6 @@ package com.vaadin.sass.testcases.css; import java.io.IOException; import java.net.URISyntaxException; -import junit.framework.Assert; - import org.junit.Test; import org.w3c.css.sac.CSSException; @@ -18,7 +16,5 @@ public class Media extends AbstractTestBase { public void testParser() throws CSSException, URISyntaxException, IOException { testParser(css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - originalScss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/css/Properties.java b/tests/sass/src/com/vaadin/sass/testcases/css/Properties.java index daceb583ec..85786916c0 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/css/Properties.java +++ b/tests/sass/src/com/vaadin/sass/testcases/css/Properties.java @@ -3,8 +3,6 @@ package com.vaadin.sass.testcases.css; import java.io.IOException; import java.net.URISyntaxException; -import junit.framework.Assert; - import org.junit.Test; import org.w3c.css.sac.CSSException; @@ -18,7 +16,5 @@ public class Properties extends AbstractTestBase { public void testParser() throws CSSException, URISyntaxException, IOException { testParser(css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - originalScss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/css/Reindeer.java b/tests/sass/src/com/vaadin/sass/testcases/css/Reindeer.java index 7370e33b16..6796aeb498 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/css/Reindeer.java +++ b/tests/sass/src/com/vaadin/sass/testcases/css/Reindeer.java @@ -3,8 +3,6 @@ package com.vaadin.sass.testcases.css; import java.io.IOException; import java.net.URISyntaxException; -import junit.framework.Assert; - import org.junit.Test; import org.w3c.css.sac.CSSException; @@ -18,7 +16,5 @@ public class Reindeer extends AbstractTestBase { public void testParser() throws CSSException, URISyntaxException, IOException { testParser(css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - originalScss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/css/Selectors.java b/tests/sass/src/com/vaadin/sass/testcases/css/Selectors.java index 6d81a75e42..af2326fd56 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/css/Selectors.java +++ b/tests/sass/src/com/vaadin/sass/testcases/css/Selectors.java @@ -3,8 +3,6 @@ package com.vaadin.sass.testcases.css; import java.io.IOException; import java.net.URISyntaxException; -import junit.framework.Assert; - import org.junit.Test; import org.w3c.css.sac.CSSException; @@ -18,7 +16,5 @@ public class Selectors extends AbstractTestBase { public void testParser() throws CSSException, URISyntaxException, IOException { testParser(css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - originalScss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/scss/Comments.java b/tests/sass/src/com/vaadin/sass/testcases/scss/Comments.java index 153f494f0d..09349968a4 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/scss/Comments.java +++ b/tests/sass/src/com/vaadin/sass/testcases/scss/Comments.java @@ -8,8 +8,8 @@ import junit.framework.Assert; import org.junit.Test; import org.w3c.css.sac.CSSException; -import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.AbstractTestBase; +import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.handler.SCSSDocumentHandler; import com.vaadin.sass.handler.SCSSDocumentHandlerImpl; import com.vaadin.sass.parser.Parser; @@ -34,8 +34,7 @@ public class Comments extends AbstractTestBase { } @Test - public void testCompiler() throws CSSException, URISyntaxException, - IOException { + public void testCompiler() throws Exception { testCompiler(scss, css); Assert.assertEquals("Original CSS and parsed CSS doesn't match", comparisonCss, parsedScss); diff --git a/tests/sass/src/com/vaadin/sass/testcases/scss/ControlDirectives.java b/tests/sass/src/com/vaadin/sass/testcases/scss/ControlDirectives.java index 1f89cdf0b2..8b8081fb78 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/scss/ControlDirectives.java +++ b/tests/sass/src/com/vaadin/sass/testcases/scss/ControlDirectives.java @@ -1,15 +1,14 @@ package com.vaadin.sass.testcases.scss; import java.io.IOException; -import java.net.URISyntaxException; import junit.framework.Assert; import org.junit.Test; import org.w3c.css.sac.CSSException; -import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.AbstractTestBase; +import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.handler.SCSSDocumentHandler; import com.vaadin.sass.handler.SCSSDocumentHandlerImpl; import com.vaadin.sass.parser.Parser; @@ -31,10 +30,7 @@ public class ControlDirectives extends AbstractTestBase { } @Test - public void testCompiler() throws CSSException, URISyntaxException, - IOException { + public void testCompiler() throws Exception { testCompiler(scss, css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - comparisonCss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/scss/Extends.java b/tests/sass/src/com/vaadin/sass/testcases/scss/Extends.java index 5ad4aacd23..5217a974db 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/scss/Extends.java +++ b/tests/sass/src/com/vaadin/sass/testcases/scss/Extends.java @@ -7,8 +7,8 @@ import org.junit.Assert; import org.junit.Test; import org.w3c.css.sac.CSSException; -import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.AbstractTestBase; +import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.handler.SCSSDocumentHandler; import com.vaadin.sass.handler.SCSSDocumentHandlerImpl; import com.vaadin.sass.parser.Parser; @@ -31,10 +31,7 @@ public class Extends extends AbstractTestBase { } @Test - public void testCompiler() throws CSSException, URISyntaxException, - IOException { + public void testCompiler() throws Exception { testCompiler(scss, css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - comparisonCss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/scss/Functions.java b/tests/sass/src/com/vaadin/sass/testcases/scss/Functions.java index 3a2bb9a4b6..0b848763a5 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/scss/Functions.java +++ b/tests/sass/src/com/vaadin/sass/testcases/scss/Functions.java @@ -1,15 +1,14 @@ package com.vaadin.sass.testcases.scss; import java.io.IOException; -import java.net.URISyntaxException; import junit.framework.Assert; import org.junit.Test; import org.w3c.css.sac.CSSException; -import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.AbstractTestBase; +import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.handler.SCSSDocumentHandler; import com.vaadin.sass.handler.SCSSDocumentHandlerImpl; import com.vaadin.sass.parser.Parser; @@ -33,10 +32,7 @@ public class Functions extends AbstractTestBase { } @Test - public void testCompiler() throws CSSException, URISyntaxException, - IOException { + public void testCompiler() throws Exception { testCompiler(scss, css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - comparisonCss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/scss/Imports.java b/tests/sass/src/com/vaadin/sass/testcases/scss/Imports.java index 49ac6e30ed..5d980cb961 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/scss/Imports.java +++ b/tests/sass/src/com/vaadin/sass/testcases/scss/Imports.java @@ -1,15 +1,14 @@ package com.vaadin.sass.testcases.scss; import java.io.IOException; -import java.net.URISyntaxException; import junit.framework.Assert; import org.junit.Test; import org.w3c.css.sac.CSSException; -import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.AbstractTestBase; +import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.handler.SCSSDocumentHandler; import com.vaadin.sass.handler.SCSSDocumentHandlerImpl; import com.vaadin.sass.parser.Parser; @@ -33,10 +32,7 @@ public class Imports extends AbstractTestBase { } @Test - public void testCompiler() throws CSSException, URISyntaxException, - IOException { + public void testCompiler() throws Exception { testCompiler(scss, css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - comparisonCss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/scss/Mixins.java b/tests/sass/src/com/vaadin/sass/testcases/scss/Mixins.java index cd4c0e2b10..dddeb0ae20 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/scss/Mixins.java +++ b/tests/sass/src/com/vaadin/sass/testcases/scss/Mixins.java @@ -9,8 +9,8 @@ import org.junit.Test; import org.w3c.css.sac.CSSException; import org.w3c.css.sac.LexicalUnit; -import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.AbstractTestBase; +import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.handler.SCSSDocumentHandler; import com.vaadin.sass.handler.SCSSDocumentHandlerImpl; import com.vaadin.sass.parser.Parser; @@ -93,11 +93,8 @@ public class Mixins extends AbstractTestBase { } @Test - public void testCompiler() throws CSSException, URISyntaxException, - IOException { + public void testCompiler() throws Exception { testCompiler(scss, css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - comparisonCss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/scss/NestedProperties.java b/tests/sass/src/com/vaadin/sass/testcases/scss/NestedProperties.java index 1c07188f56..2ad9c2d83c 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/scss/NestedProperties.java +++ b/tests/sass/src/com/vaadin/sass/testcases/scss/NestedProperties.java @@ -1,15 +1,14 @@ package com.vaadin.sass.testcases.scss; import java.io.IOException; -import java.net.URISyntaxException; import junit.framework.Assert; import org.junit.Test; import org.w3c.css.sac.CSSException; -import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.AbstractTestBase; +import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.handler.SCSSDocumentHandler; import com.vaadin.sass.handler.SCSSDocumentHandlerImpl; import com.vaadin.sass.parser.Parser; @@ -48,10 +47,7 @@ public class NestedProperties extends AbstractTestBase { } @Test - public void testCompiler() throws CSSException, URISyntaxException, - IOException { + public void testCompiler() throws Exception { testCompiler(scss, css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - comparisonCss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/scss/Nesting.java b/tests/sass/src/com/vaadin/sass/testcases/scss/Nesting.java index 01d7e6e250..d458800fc6 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/scss/Nesting.java +++ b/tests/sass/src/com/vaadin/sass/testcases/scss/Nesting.java @@ -1,15 +1,14 @@ package com.vaadin.sass.testcases.scss; import java.io.IOException; -import java.net.URISyntaxException; import junit.framework.Assert; import org.junit.Test; import org.w3c.css.sac.CSSException; -import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.AbstractTestBase; +import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.handler.SCSSDocumentHandler; import com.vaadin.sass.handler.SCSSDocumentHandlerImpl; import com.vaadin.sass.parser.Parser; @@ -66,10 +65,7 @@ public class Nesting extends AbstractTestBase { } @Test - public void testCompiler() throws CSSException, URISyntaxException, - IOException { + public void testCompiler() throws Exception { testCompiler(scss, css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - comparisonCss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/scss/ParentImports.java b/tests/sass/src/com/vaadin/sass/testcases/scss/ParentImports.java index 2eaecc319c..a97a66576b 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/scss/ParentImports.java +++ b/tests/sass/src/com/vaadin/sass/testcases/scss/ParentImports.java @@ -1,15 +1,14 @@ package com.vaadin.sass.testcases.scss; import java.io.IOException; -import java.net.URISyntaxException; import junit.framework.Assert; import org.junit.Test; import org.w3c.css.sac.CSSException; -import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.AbstractTestBase; +import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.handler.SCSSDocumentHandler; import com.vaadin.sass.handler.SCSSDocumentHandlerImpl; import com.vaadin.sass.parser.Parser; @@ -43,10 +42,7 @@ public class ParentImports extends AbstractTestBase { } @Test - public void testCompiler() throws CSSException, URISyntaxException, - IOException { + public void testCompiler() throws Exception { testCompiler(scss, css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - comparisonCss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/scss/ParentSelector.java b/tests/sass/src/com/vaadin/sass/testcases/scss/ParentSelector.java index 8ed25151db..6d05b4bfa1 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/scss/ParentSelector.java +++ b/tests/sass/src/com/vaadin/sass/testcases/scss/ParentSelector.java @@ -1,15 +1,14 @@ package com.vaadin.sass.testcases.scss; import java.io.IOException; -import java.net.URISyntaxException; import junit.framework.Assert; import org.junit.Test; import org.w3c.css.sac.CSSException; -import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.AbstractTestBase; +import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.handler.SCSSDocumentHandler; import com.vaadin.sass.handler.SCSSDocumentHandlerImpl; import com.vaadin.sass.parser.Parser; @@ -38,10 +37,7 @@ public class ParentSelector extends AbstractTestBase { } @Test - public void testCompiler() throws CSSException, URISyntaxException, - IOException { + public void testCompiler() throws Exception { testCompiler(scss, css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - comparisonCss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/scss/Semicolons.java b/tests/sass/src/com/vaadin/sass/testcases/scss/Semicolons.java index d5b63489ea..54f26a4f8f 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/scss/Semicolons.java +++ b/tests/sass/src/com/vaadin/sass/testcases/scss/Semicolons.java @@ -4,13 +4,7 @@ package com.vaadin.sass.testcases.scss; -import java.io.IOException; -import java.net.URISyntaxException; - -import junit.framework.Assert; - import org.junit.Test; -import org.w3c.css.sac.CSSException; import com.vaadin.sass.AbstractTestBase; @@ -19,13 +13,10 @@ import com.vaadin.sass.AbstractTestBase; */ public class Semicolons extends AbstractTestBase { String scss = "/scss/semicolons.scss"; - String css = "/scss/semicolons.css"; + String css = "/css/semicolons.css"; @Test - public void testCompiler() throws CSSException, URISyntaxException, - IOException { + public void testCompiler() throws Exception { testCompiler(scss, css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - comparisonCss, parsedScss); } } diff --git a/tests/sass/src/com/vaadin/sass/testcases/scss/Variables.java b/tests/sass/src/com/vaadin/sass/testcases/scss/Variables.java index 1407bbd933..c8ce1b5b5d 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/scss/Variables.java +++ b/tests/sass/src/com/vaadin/sass/testcases/scss/Variables.java @@ -1,15 +1,14 @@ package com.vaadin.sass.testcases.scss; import java.io.IOException; -import java.net.URISyntaxException; import junit.framework.Assert; import org.junit.Test; import org.w3c.css.sac.CSSException; -import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.AbstractTestBase; +import com.vaadin.sass.ScssStylesheet; import com.vaadin.sass.handler.SCSSDocumentHandler; import com.vaadin.sass.handler.SCSSDocumentHandlerImpl; import com.vaadin.sass.parser.Parser; @@ -85,10 +84,7 @@ public class Variables extends AbstractTestBase { } @Test - public void testCompiler() throws CSSException, URISyntaxException, - IOException { + public void testCompiler() throws Exception { testCompiler(scss, css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - comparisonCss, parsedScss); } } |