You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2022/10/27 22:48:55 UTC

[royale-compiler] 08/09: linter: more tests

This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 8aafd5bfa13e04f4a8f9be0c2da64909bc231c26
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Thu Oct 27 15:17:53 2022 -0700

    linter: more tests
---
 .../org/apache/royale/linter/rules/NoWithRule.java |   1 -
 .../royale/linter/rules/TestEmptyCommentRule.java  | 110 ++++++++++++++++++++
 .../linter/rules/TestEmptyFunctionBodyRule.java    | 111 +++++++++++++++++++++
 .../linter/rules/TestEmptyNestedBlockRule.java     | 109 ++++++++++++++++++++
 .../linter/rules/TestEmptyStatementRule.java       |  98 ++++++++++++++++++
 .../linter/rules/TestLineCommentPositionRule.java  |  93 +++++++++++++++++
 .../rules/TestLocalVarShadowsFieldRule.java}       |  51 ++++------
 .../royale/linter/rules/TestNoTraceRule.java}      |  51 ++++------
 .../linter/rules/TestNoVoidOperatorRule.java       |  60 +++++++++++
 .../linter/rules/TestNoWildcardImportRule.java     |  59 +++++++++++
 .../royale/linter/rules/TestNoWithRule.java}       |  51 ++++------
 .../TestOverrideContainsOnlySuperCallRule.java     |  59 +++++++++++
 12 files changed, 765 insertions(+), 88 deletions(-)

diff --git a/linter/src/main/java/org/apache/royale/linter/rules/NoWithRule.java b/linter/src/main/java/org/apache/royale/linter/rules/NoWithRule.java
index 5301d3c1e..dab769e9b 100644
--- a/linter/src/main/java/org/apache/royale/linter/rules/NoWithRule.java
+++ b/linter/src/main/java/org/apache/royale/linter/rules/NoWithRule.java
@@ -28,7 +28,6 @@ import org.apache.royale.compiler.problems.CompilerProblem;
 import org.apache.royale.linter.LinterRule;
 import org.apache.royale.linter.TokenVisitor;
 import org.apache.royale.linter.problems.ILinterProblem;
-import org.apache.royale.linter.rules.NoWithRule.NoWithLinterProblem;
 
 /**
  * Checks for uses of 'with(x)'.
diff --git a/linter/src/test/java/org/apache/royale/linter/rules/TestEmptyCommentRule.java b/linter/src/test/java/org/apache/royale/linter/rules/TestEmptyCommentRule.java
new file mode 100644
index 000000000..282a58b37
--- /dev/null
+++ b/linter/src/test/java/org/apache/royale/linter/rules/TestEmptyCommentRule.java
@@ -0,0 +1,110 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.royale.linter.rules;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.royale.compiler.problems.ICompilerProblem;
+import org.apache.royale.linter.ASLinter;
+import org.apache.royale.linter.LinterRule;
+import org.apache.royale.linter.LinterSettings;
+import org.junit.Test;
+
+public class TestEmptyCommentRule {
+	@Test
+	public void testNonEmptyLineComment() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyCommentRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "// comment", problems);
+		assertEquals(0, problems.size());
+	}
+
+	@Test
+	public void testEmptyLineComment() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyCommentRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "//", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof EmptyCommentRule.EmptyCommentLinterProblem);
+	}
+
+	@Test
+	public void testWhitespaceOnlyLineComment() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyCommentRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "//    ", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof EmptyCommentRule.EmptyCommentLinterProblem);
+	}
+
+	@Test
+	public void testNonEmptyBlockComment() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyCommentRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "/* comment */", problems);
+		assertEquals(0, problems.size());
+	}
+
+	@Test
+	public void testWhitespaceOnlyBlockComment() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyCommentRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "/*    */", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof EmptyCommentRule.EmptyCommentLinterProblem);
+	}
+
+	@Test
+	public void testWhitespaceOnlyBlockComment2() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyCommentRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "/*\n\n\n\n*/", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof EmptyCommentRule.EmptyCommentLinterProblem);
+	}
+}
\ No newline at end of file
diff --git a/linter/src/test/java/org/apache/royale/linter/rules/TestEmptyFunctionBodyRule.java b/linter/src/test/java/org/apache/royale/linter/rules/TestEmptyFunctionBodyRule.java
new file mode 100644
index 000000000..3af246345
--- /dev/null
+++ b/linter/src/test/java/org/apache/royale/linter/rules/TestEmptyFunctionBodyRule.java
@@ -0,0 +1,111 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.royale.linter.rules;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.royale.compiler.problems.ICompilerProblem;
+import org.apache.royale.linter.ASLinter;
+import org.apache.royale.linter.LinterRule;
+import org.apache.royale.linter.LinterSettings;
+import org.junit.Test;
+
+public class TestEmptyFunctionBodyRule {
+	@Test
+	public void testNonEmptyFunctionBody() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyFunctionBodyRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "function myFunction():void{var a:String = null;}", problems);
+		assertEquals(0, problems.size());
+	}
+
+	@Test
+	public void testEmptyFunctionBody() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyFunctionBodyRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "function myFunction():void {}", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof EmptyFunctionBodyRule.EmptyFunctionBodyLinterProblem);
+	}
+
+	@Test
+	public void testWhitespaceOnlyFunctionBody1() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyFunctionBodyRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "function myFunction():void {    }", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof EmptyFunctionBodyRule.EmptyFunctionBodyLinterProblem);
+	}
+
+	@Test
+	public void testWhitespaceOnlyFunctionBody2() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyFunctionBodyRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "function myFunction():void {\n\n\n\n}", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof EmptyFunctionBodyRule.EmptyFunctionBodyLinterProblem);
+	}
+
+	@Test
+	public void testCommentOnlyFunctionBody1() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyFunctionBodyRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		// you need to explain why it's empty
+		linter.lint("file.as", "function myFunction():void {/* comment */}", problems);
+		assertEquals(0, problems.size());
+	}
+
+	@Test
+	public void testCommentOnlyFunctionBody2() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyFunctionBodyRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		// you need to explain why it's empty
+		linter.lint("file.as", "function myFunction():void {// comment\n}", problems);
+		assertEquals(0, problems.size());
+	}
+}
\ No newline at end of file
diff --git a/linter/src/test/java/org/apache/royale/linter/rules/TestEmptyNestedBlockRule.java b/linter/src/test/java/org/apache/royale/linter/rules/TestEmptyNestedBlockRule.java
new file mode 100644
index 000000000..8e6a19c30
--- /dev/null
+++ b/linter/src/test/java/org/apache/royale/linter/rules/TestEmptyNestedBlockRule.java
@@ -0,0 +1,109 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.royale.linter.rules;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.royale.compiler.problems.ICompilerProblem;
+import org.apache.royale.linter.ASLinter;
+import org.apache.royale.linter.LinterRule;
+import org.apache.royale.linter.LinterSettings;
+import org.junit.Test;
+
+public class TestEmptyNestedBlockRule {
+	@Test
+	public void testNonEmptyNestedBlock() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyNestedBlockRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "function myFunction():void{var a:String = null;if(true){var b:Number = 123.4}}", problems);
+		assertEquals(0, problems.size());
+	}
+
+	@Test
+	public void testEmptyNestedBlock() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyNestedBlockRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "function myFunction():void{var a:String = null;if(true){}}", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof EmptyNestedBlockRule.EmptyNestedBlockLinterProblem);
+	}
+
+	@Test
+	public void testEmptyNestedBlockWhitespaceOnly1() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyNestedBlockRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "function myFunction():void{var a:String = null;if(true){    }}", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof EmptyNestedBlockRule.EmptyNestedBlockLinterProblem);
+	}
+
+	@Test
+	public void testEmptyNestedBlockWhitespaceOnly2() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyNestedBlockRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "function myFunction():void{var a:String = null;if(true){\n\n\n\n}}", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof EmptyNestedBlockRule.EmptyNestedBlockLinterProblem);
+	}
+
+	@Test
+	public void testEmptyNestedBlockCommentOnly1() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyNestedBlockRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "function myFunction():void{var a:String = null;if(true){/* comment */}}", problems);
+		assertEquals(0, problems.size());
+	}
+
+	@Test
+	public void testEmptyNestedBlockCommentOnly2() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyNestedBlockRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "function myFunction():void{var a:String = null;if(true){// comment\n}}", problems);
+		assertEquals(0, problems.size());
+	}
+}
\ No newline at end of file
diff --git a/linter/src/test/java/org/apache/royale/linter/rules/TestEmptyStatementRule.java b/linter/src/test/java/org/apache/royale/linter/rules/TestEmptyStatementRule.java
new file mode 100644
index 000000000..889f1eb38
--- /dev/null
+++ b/linter/src/test/java/org/apache/royale/linter/rules/TestEmptyStatementRule.java
@@ -0,0 +1,98 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.royale.linter.rules;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.royale.compiler.problems.ICompilerProblem;
+import org.apache.royale.linter.ASLinter;
+import org.apache.royale.linter.LinterRule;
+import org.apache.royale.linter.LinterSettings;
+import org.junit.Test;
+
+public class TestEmptyStatementRule {
+	@Test
+	public void testNonEmptyStatement() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyStatementRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "a;b;", problems);
+		assertEquals(0, problems.size());
+	}
+
+	@Test
+	public void testEmptyStatement1() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyStatementRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "a;;", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof EmptyStatementRule.EmptyStatementLinterProblem);
+	}
+
+	@Test
+	public void testEmptyStatement2() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyStatementRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", ";a;", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof EmptyStatementRule.EmptyStatementLinterProblem);
+	}
+
+	@Test
+	public void testEmptyStatementBlock1() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyStatementRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "{a;;}", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof EmptyStatementRule.EmptyStatementLinterProblem);
+	}
+
+	@Test
+	public void testEmptyStatementBlock2() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new EmptyStatementRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "{;a;}", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof EmptyStatementRule.EmptyStatementLinterProblem);
+	}
+}
\ No newline at end of file
diff --git a/linter/src/test/java/org/apache/royale/linter/rules/TestLineCommentPositionRule.java b/linter/src/test/java/org/apache/royale/linter/rules/TestLineCommentPositionRule.java
new file mode 100644
index 000000000..106bf1221
--- /dev/null
+++ b/linter/src/test/java/org/apache/royale/linter/rules/TestLineCommentPositionRule.java
@@ -0,0 +1,93 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.royale.linter.rules;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.royale.compiler.problems.ICompilerProblem;
+import org.apache.royale.linter.ASLinter;
+import org.apache.royale.linter.LinterRule;
+import org.apache.royale.linter.LinterSettings;
+import org.apache.royale.linter.config.LineCommentPosition;
+import org.junit.Test;
+
+public class TestLineCommentPositionRule {
+	@Test
+	public void testBeside() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		LineCommentPositionRule rule = new LineCommentPositionRule();
+		rule.position = LineCommentPosition.BESIDE;
+		rules.add(rule);
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "a; // comment", problems);
+		assertEquals(0, problems.size());
+	}
+
+	@Test
+	public void testNotBeside() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		LineCommentPositionRule rule = new LineCommentPositionRule();
+		rule.position = LineCommentPosition.BESIDE;
+		rules.add(rule);
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "// comment\na;", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof LineCommentPositionRule.LineCommentPositionLinterProblem);
+	}
+
+	@Test
+	public void testAbove() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		LineCommentPositionRule rule = new LineCommentPositionRule();
+		rule.position = LineCommentPosition.ABOVE;
+		rules.add(rule);
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "// comment\na;", problems);
+		assertEquals(0, problems.size());
+	}
+
+	@Test
+	public void testNotAbove() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		LineCommentPositionRule rule = new LineCommentPositionRule();
+		rule.position = LineCommentPosition.ABOVE;
+		rules.add(rule);
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "a; // comment", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof LineCommentPositionRule.LineCommentPositionLinterProblem);
+	}
+}
\ No newline at end of file
diff --git a/linter/src/main/java/org/apache/royale/linter/rules/NoWithRule.java b/linter/src/test/java/org/apache/royale/linter/rules/TestLocalVarShadowsFieldRule.java
similarity index 51%
copy from linter/src/main/java/org/apache/royale/linter/rules/NoWithRule.java
copy to linter/src/test/java/org/apache/royale/linter/rules/TestLocalVarShadowsFieldRule.java
index 5301d3c1e..697a68dc4 100644
--- a/linter/src/main/java/org/apache/royale/linter/rules/NoWithRule.java
+++ b/linter/src/test/java/org/apache/royale/linter/rules/TestLocalVarShadowsFieldRule.java
@@ -19,36 +19,29 @@
 
 package org.apache.royale.linter.rules;
 
-import java.util.HashMap;
-import java.util.Map;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
-import org.apache.royale.compiler.internal.parsing.as.ASTokenTypes;
-import org.apache.royale.compiler.parsing.IASToken;
-import org.apache.royale.compiler.problems.CompilerProblem;
-import org.apache.royale.linter.LinterRule;
-import org.apache.royale.linter.TokenVisitor;
-import org.apache.royale.linter.problems.ILinterProblem;
-import org.apache.royale.linter.rules.NoWithRule.NoWithLinterProblem;
-
-/**
- * Checks for uses of 'with(x)'.
- */
-public class NoWithRule extends LinterRule {
-	@Override
-	public Map<Integer, TokenVisitor> getTokenVisitors() {
-		Map<Integer, TokenVisitor> result = new HashMap<>();
-		result.put(ASTokenTypes.TOKEN_KEYWORD_WITH, (token, tokenQuery, problems) -> {
-			problems.add(new NoWithLinterProblem(token));
-		});
-		return result;
-	}
+import java.util.ArrayList;
+import java.util.List;
 
-	public static class NoWithLinterProblem extends CompilerProblem implements ILinterProblem {
-		public static final String DESCRIPTION = "Must not use 'with' statement";
+import org.apache.royale.compiler.problems.ICompilerProblem;
+import org.apache.royale.linter.ASLinter;
+import org.apache.royale.linter.LinterRule;
+import org.apache.royale.linter.LinterSettings;
+import org.junit.Test;
 
-		public NoWithLinterProblem(IASToken token)
-		{
-			super(token);
-		}
+public class TestLocalVarShadowsFieldRule {
+	@Test
+	public void testLocalVarShadowsField() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new LocalVarShadowsFieldRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "class MyClass{var fieldName:String;function myFunction():void{var fieldName:Number;}}", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof LocalVarShadowsFieldRule.LocalVarShadowsFieldLinterProblem);
 	}
-}
+}
\ No newline at end of file
diff --git a/linter/src/main/java/org/apache/royale/linter/rules/NoWithRule.java b/linter/src/test/java/org/apache/royale/linter/rules/TestNoTraceRule.java
similarity index 51%
copy from linter/src/main/java/org/apache/royale/linter/rules/NoWithRule.java
copy to linter/src/test/java/org/apache/royale/linter/rules/TestNoTraceRule.java
index 5301d3c1e..c08b4183c 100644
--- a/linter/src/main/java/org/apache/royale/linter/rules/NoWithRule.java
+++ b/linter/src/test/java/org/apache/royale/linter/rules/TestNoTraceRule.java
@@ -19,36 +19,29 @@
 
 package org.apache.royale.linter.rules;
 
-import java.util.HashMap;
-import java.util.Map;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
-import org.apache.royale.compiler.internal.parsing.as.ASTokenTypes;
-import org.apache.royale.compiler.parsing.IASToken;
-import org.apache.royale.compiler.problems.CompilerProblem;
-import org.apache.royale.linter.LinterRule;
-import org.apache.royale.linter.TokenVisitor;
-import org.apache.royale.linter.problems.ILinterProblem;
-import org.apache.royale.linter.rules.NoWithRule.NoWithLinterProblem;
-
-/**
- * Checks for uses of 'with(x)'.
- */
-public class NoWithRule extends LinterRule {
-	@Override
-	public Map<Integer, TokenVisitor> getTokenVisitors() {
-		Map<Integer, TokenVisitor> result = new HashMap<>();
-		result.put(ASTokenTypes.TOKEN_KEYWORD_WITH, (token, tokenQuery, problems) -> {
-			problems.add(new NoWithLinterProblem(token));
-		});
-		return result;
-	}
+import java.util.ArrayList;
+import java.util.List;
 
-	public static class NoWithLinterProblem extends CompilerProblem implements ILinterProblem {
-		public static final String DESCRIPTION = "Must not use 'with' statement";
+import org.apache.royale.compiler.problems.ICompilerProblem;
+import org.apache.royale.linter.ASLinter;
+import org.apache.royale.linter.LinterRule;
+import org.apache.royale.linter.LinterSettings;
+import org.junit.Test;
 
-		public NoWithLinterProblem(IASToken token)
-		{
-			super(token);
-		}
+public class TestNoTraceRule {
+	@Test
+	public void testTrace() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new NoTraceRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "trace(a);", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof NoTraceRule.NoTraceLinterProblem);
 	}
-}
+}
\ No newline at end of file
diff --git a/linter/src/test/java/org/apache/royale/linter/rules/TestNoVoidOperatorRule.java b/linter/src/test/java/org/apache/royale/linter/rules/TestNoVoidOperatorRule.java
new file mode 100644
index 000000000..fe2822b5a
--- /dev/null
+++ b/linter/src/test/java/org/apache/royale/linter/rules/TestNoVoidOperatorRule.java
@@ -0,0 +1,60 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.royale.linter.rules;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.royale.compiler.problems.ICompilerProblem;
+import org.apache.royale.linter.ASLinter;
+import org.apache.royale.linter.LinterRule;
+import org.apache.royale.linter.LinterSettings;
+import org.junit.Test;
+
+public class TestNoVoidOperatorRule {
+	@Test
+	public void testVoidOperator() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new NoVoidOperatorRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "void a;", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof NoVoidOperatorRule.NoVoidOperatorLinterProblem);
+	}
+
+	@Test
+	public void testVoidOperatorCall() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new NoVoidOperatorRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "void(a);", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof NoVoidOperatorRule.NoVoidOperatorLinterProblem);
+	}
+}
\ No newline at end of file
diff --git a/linter/src/test/java/org/apache/royale/linter/rules/TestNoWildcardImportRule.java b/linter/src/test/java/org/apache/royale/linter/rules/TestNoWildcardImportRule.java
new file mode 100644
index 000000000..cb8597c1f
--- /dev/null
+++ b/linter/src/test/java/org/apache/royale/linter/rules/TestNoWildcardImportRule.java
@@ -0,0 +1,59 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.royale.linter.rules;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.royale.compiler.problems.ICompilerProblem;
+import org.apache.royale.linter.ASLinter;
+import org.apache.royale.linter.LinterRule;
+import org.apache.royale.linter.LinterSettings;
+import org.junit.Test;
+
+public class TestNoWildcardImportRule {
+	@Test
+	public void testWildcardImport() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new NoWildcardImportRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "import a.b.c.*;", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof NoWildcardImportRule.NoWildcardImportLinterProblem);
+	}
+
+	@Test
+	public void testNonWildcardImport() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new NoWildcardImportRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "import a.b.c.d;", problems);
+		assertEquals(0, problems.size());
+	}
+}
\ No newline at end of file
diff --git a/linter/src/main/java/org/apache/royale/linter/rules/NoWithRule.java b/linter/src/test/java/org/apache/royale/linter/rules/TestNoWithRule.java
similarity index 51%
copy from linter/src/main/java/org/apache/royale/linter/rules/NoWithRule.java
copy to linter/src/test/java/org/apache/royale/linter/rules/TestNoWithRule.java
index 5301d3c1e..6d46dd327 100644
--- a/linter/src/main/java/org/apache/royale/linter/rules/NoWithRule.java
+++ b/linter/src/test/java/org/apache/royale/linter/rules/TestNoWithRule.java
@@ -19,36 +19,29 @@
 
 package org.apache.royale.linter.rules;
 
-import java.util.HashMap;
-import java.util.Map;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
-import org.apache.royale.compiler.internal.parsing.as.ASTokenTypes;
-import org.apache.royale.compiler.parsing.IASToken;
-import org.apache.royale.compiler.problems.CompilerProblem;
-import org.apache.royale.linter.LinterRule;
-import org.apache.royale.linter.TokenVisitor;
-import org.apache.royale.linter.problems.ILinterProblem;
-import org.apache.royale.linter.rules.NoWithRule.NoWithLinterProblem;
-
-/**
- * Checks for uses of 'with(x)'.
- */
-public class NoWithRule extends LinterRule {
-	@Override
-	public Map<Integer, TokenVisitor> getTokenVisitors() {
-		Map<Integer, TokenVisitor> result = new HashMap<>();
-		result.put(ASTokenTypes.TOKEN_KEYWORD_WITH, (token, tokenQuery, problems) -> {
-			problems.add(new NoWithLinterProblem(token));
-		});
-		return result;
-	}
+import java.util.ArrayList;
+import java.util.List;
 
-	public static class NoWithLinterProblem extends CompilerProblem implements ILinterProblem {
-		public static final String DESCRIPTION = "Must not use 'with' statement";
+import org.apache.royale.compiler.problems.ICompilerProblem;
+import org.apache.royale.linter.ASLinter;
+import org.apache.royale.linter.LinterRule;
+import org.apache.royale.linter.LinterSettings;
+import org.junit.Test;
 
-		public NoWithLinterProblem(IASToken token)
-		{
-			super(token);
-		}
+public class TestNoWithRule {
+	@Test
+	public void testWith() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new NoWithRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "with(a){}", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof NoWithRule.NoWithLinterProblem);
 	}
-}
+}
\ No newline at end of file
diff --git a/linter/src/test/java/org/apache/royale/linter/rules/TestOverrideContainsOnlySuperCallRule.java b/linter/src/test/java/org/apache/royale/linter/rules/TestOverrideContainsOnlySuperCallRule.java
new file mode 100644
index 000000000..1911a4ab1
--- /dev/null
+++ b/linter/src/test/java/org/apache/royale/linter/rules/TestOverrideContainsOnlySuperCallRule.java
@@ -0,0 +1,59 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.royale.linter.rules;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.royale.compiler.problems.ICompilerProblem;
+import org.apache.royale.linter.ASLinter;
+import org.apache.royale.linter.LinterRule;
+import org.apache.royale.linter.LinterSettings;
+import org.junit.Test;
+
+public class TestOverrideContainsOnlySuperCallRule {
+	@Test
+	public void testOverrideContainsOnlySuperCall() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new OverrideContainsOnlySuperCallRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "class MyClass{override function myFunction():void{super.myFunction();}}", problems);
+		assertEquals(1, problems.size());
+		assertTrue(problems.get(0) instanceof OverrideContainsOnlySuperCallRule.OverrideContainsOnlySuperCallLinterProblem);
+	}
+
+	@Test
+	public void testOverrideContainsOtherSuperCall() {
+		List<LinterRule> rules = new ArrayList<LinterRule>();
+		rules.add(new OverrideContainsOnlySuperCallRule());
+		LinterSettings settings = new LinterSettings();
+		settings.rules = rules;
+		ASLinter linter = new ASLinter(settings);
+		List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
+		linter.lint("file.as", "class MyClass{override function myFunction():void{super.anotherFunction();}}", problems);
+		assertEquals(0, problems.size());
+	}
+}
\ No newline at end of file