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 fd6ab58cc20bf171fd8e8e58ca5fdfd11db9646a
Author: Josh Tynjala <[email protected]>
AuthorDate: Mon Oct 31 13:15:18 2022 -0700

    linter: tests for rest of rules
---
 .../linter/rules/TestMXMLEmptyAttributeRule.java   |  59 +++++
 .../royale/linter/rules/TestMaxBlockDepthRule.java |  91 ++++++++
 .../royale/linter/rules/TestMaxParametersRule.java |  91 ++++++++
 .../royale/linter/rules/TestMissingASDocRule.java  | 250 +++++++++++++++++++++
 .../rules/TestMissingConstructorSuperRule.java     |  59 +++++
 .../linter/rules/TestMissingNamespaceRule.java     | 184 +++++++++++++++
 .../linter/rules/TestMissingSemicolonRule.java     |  47 ++++
 .../royale/linter/rules/TestMissingTypeRule.java   | 134 +++++++++++
 8 files changed, 915 insertions(+)

diff --git 
a/linter/src/test/java/org/apache/royale/linter/rules/TestMXMLEmptyAttributeRule.java
 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMXMLEmptyAttributeRule.java
new file mode 100644
index 000000000..7da6188a9
--- /dev/null
+++ 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMXMLEmptyAttributeRule.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.LinterRule;
+import org.apache.royale.linter.LinterSettings;
+import org.apache.royale.linter.MXMLLinter;
+import org.junit.Test;
+
+public class TestMXMLEmptyAttributeRule {
+       @Test
+       public void testMXMLAttributeNotEmpty() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MXMLEmptyAttributeRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               MXMLLinter linter = new MXMLLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.mxml", "<fx:Object attr=\"value\"/>", 
problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testMXMLAttributeEmpty() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MXMLEmptyAttributeRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               MXMLLinter linter = new MXMLLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.mxml", "<fx:Object attr=\"\"/>", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MXMLEmptyAttributeRule.MXMLEmptyAttributeLinterProblem);
+       }
+}
\ No newline at end of file
diff --git 
a/linter/src/test/java/org/apache/royale/linter/rules/TestMaxBlockDepthRule.java
 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMaxBlockDepthRule.java
new file mode 100644
index 000000000..eeb286e15
--- /dev/null
+++ 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMaxBlockDepthRule.java
@@ -0,0 +1,91 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 TestMaxBlockDepthRule {
+       @Test
+       public void testZeroBlocks() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               MaxBlockDepthRule rule = new MaxBlockDepthRule();
+               rule.maximum = 2;
+               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", "function myFunction():void{}", 
problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testLessThanMaxBlockDepth() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               MaxBlockDepthRule rule = new MaxBlockDepthRule();
+               rule.maximum = 2;
+               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", "function 
myFunction():void{if(true){}}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testEqualToMaxBlockDepth() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               MaxBlockDepthRule rule = new MaxBlockDepthRule();
+               rule.maximum = 2;
+               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", "function 
myFunction():void{if(true){while(true){}}}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testMoreThanMaxBlockDepth() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               MaxBlockDepthRule rule = new MaxBlockDepthRule();
+               rule.maximum = 2;
+               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", "function 
myFunction():void{if(true){while(true){for(;;){}}}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MaxBlockDepthRule.MaxBlockDepthLinterProblem);
+       }
+}
\ No newline at end of file
diff --git 
a/linter/src/test/java/org/apache/royale/linter/rules/TestMaxParametersRule.java
 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMaxParametersRule.java
new file mode 100644
index 000000000..3da0048ed
--- /dev/null
+++ 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMaxParametersRule.java
@@ -0,0 +1,91 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 TestMaxParametersRule {
+       @Test
+       public void testZeroParameters() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               MaxParametersRule rule = new MaxParametersRule();
+               rule.maximum = 2;
+               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", "function myFunction():void {}", 
problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testLessThanMaxParameter() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               MaxParametersRule rule = new MaxParametersRule();
+               rule.maximum = 2;
+               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", "function myFunction(param1:String):void 
{}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testEqualToMaxParameters() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               MaxParametersRule rule = new MaxParametersRule();
+               rule.maximum = 2;
+               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", "function myFunction(param1:String, 
param2:Number):void {}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testMoreThanMaxParameters() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               MaxParametersRule rule = new MaxParametersRule();
+               rule.maximum = 2;
+               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", "function myFunction(param1:String, 
param2:Number, param3:Boolean):void {}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MaxParametersRule.MaxParametersLinterProblem);
+       }
+}
\ No newline at end of file
diff --git 
a/linter/src/test/java/org/apache/royale/linter/rules/TestMissingASDocRule.java 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMissingASDocRule.java
new file mode 100644
index 000000000..cf94e0ba4
--- /dev/null
+++ 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMissingASDocRule.java
@@ -0,0 +1,250 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 TestMissingASDocRule {
+       @Test
+       public void testClassWithASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{/** hello */ public class 
MyClass{}}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testClassMissingASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{public class MyClass{}}", 
problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingASDocRule.MissingASDocLinterProblem);
+       }
+
+       @Test
+       public void testClassEmptyASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{/** */ public class 
MyClass{}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingASDocRule.EmptyASDocLinterProblem);
+       }
+
+       @Test
+       public void testInterfaceWithASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{/** hello */ public interface 
MyClass{}}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testInterfaceMissingASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{public interface MyClass{}}", 
problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingASDocRule.MissingASDocLinterProblem);
+       }
+
+       @Test
+       public void testInterfaceEmptyASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{/** */ public interface 
MyClass{}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingASDocRule.EmptyASDocLinterProblem);
+       }
+
+       @Test
+       public void testFieldWithASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{/** class */ public class 
MyClass{/** hello */public var myVar:String;}}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testFieldMissingASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{/** class */ public class 
MyClass{public var myVar:String;}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingASDocRule.MissingASDocLinterProblem);
+       }
+
+       @Test
+       public void testFieldEmptyASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{/** class */ public class 
MyClass{/** */public var myVar:String;}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingASDocRule.EmptyASDocLinterProblem);
+       }
+
+       @Test
+       public void testMethodWithASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{/** class */ public class 
MyClass{/** hello */public function myMethod():void{}}}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testMethodMissingASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{/** class */ public class 
MyClass{public function myMethod():void{}}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingASDocRule.MissingASDocLinterProblem);
+       }
+
+       @Test
+       public void testMethodEmptyASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{/** class */ public class 
MyClass{/** */public function myMethod():void{}}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingASDocRule.EmptyASDocLinterProblem);
+       }
+
+       @Test
+       public void testPackageVariableWithASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{/** hello */ public var 
myVar:String;}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testPackageVariableMissingASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{public var myVar:String;}", 
problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingASDocRule.MissingASDocLinterProblem);
+       }
+
+       @Test
+       public void testPackageVariableEmptyASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{/** */ public var 
myVar:String;}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingASDocRule.EmptyASDocLinterProblem);
+       }
+
+       @Test
+       public void testPackageFunctionMissingASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{public function 
myFunction():void{}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingASDocRule.MissingASDocLinterProblem);
+       }
+
+       @Test
+       public void testPackageFunctionEmptyASDoc() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingASDocRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{/** */ public function 
myFunction():void{}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingASDocRule.EmptyASDocLinterProblem);
+       }
+}
diff --git 
a/linter/src/test/java/org/apache/royale/linter/rules/TestMissingConstructorSuperRule.java
 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMissingConstructorSuperRule.java
new file mode 100644
index 000000000..2f04121c8
--- /dev/null
+++ 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMissingConstructorSuperRule.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 TestMissingConstructorSuperRule {
+       @Test
+       public void testWithConstructorSuper() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingConstructorSuperRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{class MyClass extends 
OtherClass{public function MyClass(){super();}}}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testMissingConstructorSuper() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingConstructorSuperRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{class MyClass extends 
OtherClass{public function MyClass(){}}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingConstructorSuperRule.MissingConstructorSuperLinterProblem);
+       }
+}
\ No newline at end of file
diff --git 
a/linter/src/test/java/org/apache/royale/linter/rules/TestMissingNamespaceRule.java
 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMissingNamespaceRule.java
new file mode 100644
index 000000000..b1466a6a3
--- /dev/null
+++ 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMissingNamespaceRule.java
@@ -0,0 +1,184 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 TestMissingNamespaceRule {
+       @Test
+       public void testWithClassNamespace() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingNamespaceRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{public class MyClass{}}", 
problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testMissingClassNamespace() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingNamespaceRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{class MyClass{}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingNamespaceRule.MissingNamespaceOnClassLinterProblem);
+       }
+
+       @Test
+       public void testWithInterfaceNamespace() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingNamespaceRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{public interface 
MyInterface{}}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testMissingInterfaceNamespace() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingNamespaceRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{interface MyInterface{}}", 
problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingNamespaceRule.MissingNamespaceOnInterfaceLinterProblem);
+       }
+
+       @Test
+       public void testWithFieldNamespace() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingNamespaceRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{public class MyClass{private 
var myField:String;}}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testMissingFieldNamespace() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingNamespaceRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{public class MyClass{var 
myField:String;}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingNamespaceRule.MissingNamespaceOnFieldLinterProblem);
+       }
+
+       @Test
+       public void testWithMethodNamespace() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingNamespaceRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{public class MyClass{private 
function myMethod():void{}}}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testMissingMethodNamespace() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingNamespaceRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{public class MyClass{function 
myMethod():void{}}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingNamespaceRule.MissingNamespaceOnMethodLinterProblem);
+       }
+
+       @Test
+       public void testWithPackageVarNamespace() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingNamespaceRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{public var myVar:String;}", 
problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testMissingPackageVarNamespace() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingNamespaceRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{var myVar:String;}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingNamespaceRule.MissingNamespaceOnPackageVariableLinterProblem);
+       }
+
+       @Test
+       public void testWithPackageFunctionNamespace() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingNamespaceRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{public function 
myFunction():void{}}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testMissingPackageFunctionNamespace() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingNamespaceRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "package{function myFunction():void{}}", 
problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingNamespaceRule.MissingNamespaceOnPackageFunctionLinterProblem);
+       }
+}
diff --git 
a/linter/src/test/java/org/apache/royale/linter/rules/TestMissingSemicolonRule.java
 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMissingSemicolonRule.java
new file mode 100644
index 000000000..2dcbf2c33
--- /dev/null
+++ 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMissingSemicolonRule.java
@@ -0,0 +1,47 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.LinterRule;
+import org.apache.royale.linter.LinterSettings;
+import org.apache.royale.linter.ASLinter;
+import org.junit.Test;
+
+public class TestMissingSemicolonRule {
+       @Test
+       public void testMissingSemicolon() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingSemicolonRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "var s:String", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingSemicolonRule.MissingSemicolonLinterProblem);
+       }
+}
diff --git 
a/linter/src/test/java/org/apache/royale/linter/rules/TestMissingTypeRule.java 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMissingTypeRule.java
new file mode 100644
index 000000000..5aa0d212f
--- /dev/null
+++ 
b/linter/src/test/java/org/apache/royale/linter/rules/TestMissingTypeRule.java
@@ -0,0 +1,134 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.LinterRule;
+import org.apache.royale.linter.LinterSettings;
+import org.apache.royale.linter.ASLinter;
+import org.junit.Test;
+
+public class TestMissingTypeRule {
+       @Test
+       public void testWithFieldType() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingTypeRule());
+               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;}", 
problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testMissingFieldType() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingTypeRule());
+               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;}", 
problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingTypeRule.MissingVariableTypeLinterProblem);
+       }
+
+       @Test
+       public void testWithLocalVarType() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingTypeRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "class MyClass{function 
methodName():void{var fieldName:String;}}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testMissingLocalVarType() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingTypeRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "class MyClass{function 
methodName():void{var fieldName;}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingTypeRule.MissingVariableTypeLinterProblem);
+       }
+
+       @Test
+       public void testWithParameterType() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingTypeRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "class MyClass{function 
methodName(param:String):void{}}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testMissingParameterType() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingTypeRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "class MyClass{function 
methodName(param):void{}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingTypeRule.MissingFunctionParameterTypeLinterProblem);
+       }
+
+       @Test
+       public void testWithReturnType() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingTypeRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "class MyClass{function 
methodName():String{return null;}}", problems);
+               assertEquals(0, problems.size());
+       }
+
+       @Test
+       public void testMissingReturnType() {
+               List<LinterRule> rules = new ArrayList<LinterRule>();
+               rules.add(new MissingTypeRule());
+               LinterSettings settings = new LinterSettings();
+               settings.rules = rules;
+               ASLinter linter = new ASLinter(settings);
+               List<ICompilerProblem> problems = new 
ArrayList<ICompilerProblem>();
+               linter.lint("file.as", "class MyClass{function 
methodName(){}}", problems);
+               assertEquals(1, problems.size());
+               assertTrue(problems.get(0) instanceof 
MissingTypeRule.MissingFunctionReturnTypeLinterProblem);
+       }
+}
\ No newline at end of file


Reply via email to