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 2848b527e8492ca9c6baac353f78dfe5506eb919
Author: Josh Tynjala <[email protected]>
AuthorDate: Fri Jun 28 09:25:14 2024 -0700

    compiler: new tests to ensure that compc-only options produce errors in 
mxmlc
---
 .../test/java/options/CompcOnlyOptionsTests.java   | 219 +++++++++++++++++++++
 .../src/test/resources/unit_tests/included.xml     |  22 +++
 .../src/test/resources/unit_tests/stylesheet.css   |  21 ++
 3 files changed, 262 insertions(+)

diff --git a/compiler/src/test/java/options/CompcOnlyOptionsTests.java 
b/compiler/src/test/java/options/CompcOnlyOptionsTests.java
new file mode 100644
index 000000000..b6ebf825d
--- /dev/null
+++ b/compiler/src/test/java/options/CompcOnlyOptionsTests.java
@@ -0,0 +1,219 @@
+/*
+ *
+ *  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 options;
+
+import org.junit.Test;
+
+import as.ASFeatureTestsBase;
+
+public class CompcOnlyOptionsTests extends ASFeatureTestsBase
+{
+    @Test
+    public void testDirectoryOption()
+    {
+        String[] imports = new String[]
+        {
+        };
+        String[] declarations = new String[]
+        {
+        };
+        String[] testCode = new String[]
+        {
+        };
+        String[] extra = new String[]
+        {
+        };
+        String source = getAS(imports, declarations, testCode, extra);
+
+        String[] options = new String[]
+        {
+            "-directory=true"
+        };
+        compileAndExpectErrors(source, false,false,false, options,"unknown 
configuration variable 'directory'.\n\n");
+    }
+
+    @Test
+    public void testIncludeClassesOption()
+    {
+        String[] imports = new String[]
+        {
+        };
+        String[] declarations = new String[]
+        {
+        };
+        String[] testCode = new String[]
+        {
+        };
+        String[] extra = new String[]
+        {
+        };
+        String source = getAS(imports, declarations, testCode, extra);
+
+        String[] options = new String[]
+        {
+            "-include-classes+=MyClass"
+        };
+        compileAndExpectErrors(source, false,false,false, options,"unknown 
configuration variable 'include-classes'.\n\n");
+    }
+
+    @Test
+    public void testIncludeFileOption()
+    {
+        String[] imports = new String[]
+        {
+        };
+        String[] declarations = new String[]
+        {
+        };
+        String[] testCode = new String[]
+        {
+        };
+        String[] extra = new String[]
+        {
+        };
+        String source = getAS(imports, declarations, testCode, extra);
+
+        String[] options = new String[]
+        {
+            
"-include-file+=file.xml,src/test/resources/unit_tests/included.xml"
+        };
+        compileAndExpectErrors(source, false,false,false, options,"unknown 
configuration variable 'include-file'.\n\n");
+    }
+
+    @Test
+    public void testIncludeLookupOnlyOption()
+    {
+        String[] imports = new String[]
+        {
+        };
+        String[] declarations = new String[]
+        {
+        };
+        String[] testCode = new String[]
+        {
+        };
+        String[] extra = new String[]
+        {
+        };
+        String source = getAS(imports, declarations, testCode, extra);
+
+        String[] options = new String[]
+        {
+            "-include-lookup-only=true"
+        };
+        compileAndExpectErrors(source, false,false,false, options,"unknown 
configuration variable 'include-lookup-only'.\n\n");
+    }
+
+    @Test
+    public void testIncludeNamespacesOption()
+    {
+        String[] imports = new String[]
+        {
+        };
+        String[] declarations = new String[]
+        {
+        };
+        String[] testCode = new String[]
+        {
+        };
+        String[] extra = new String[]
+        {
+        };
+        String source = getAS(imports, declarations, testCode, extra);
+
+        String[] options = new String[]
+        {
+            "-include-namespaces+=uri"
+        };
+        compileAndExpectErrors(source, false,false,false, options,"unknown 
configuration variable 'include-namespaces'.\n\n");
+    }
+
+    @Test
+    public void testIncludeSourcesOption()
+    {
+        String[] imports = new String[]
+        {
+        };
+        String[] declarations = new String[]
+        {
+        };
+        String[] testCode = new String[]
+        {
+        };
+        String[] extra = new String[]
+        {
+        };
+        String source = getAS(imports, declarations, testCode, extra);
+
+        String[] options = new String[]
+        {
+            "-include-sources+=src"
+        };
+        compileAndExpectErrors(source, false,false,false, options,"unknown 
configuration variable 'include-sources'.\n\n");
+    }
+
+    @Test
+    public void testIncludeStyleSheetOption()
+    {
+        String[] imports = new String[]
+        {
+        };
+        String[] declarations = new String[]
+        {
+        };
+        String[] testCode = new String[]
+        {
+        };
+        String[] extra = new String[]
+        {
+        };
+        String source = getAS(imports, declarations, testCode, extra);
+
+        String[] options = new String[]
+        {
+            "-include-stylesheet+=src/test/resources/unit_tests/stylesheet.css"
+        };
+        compileAndExpectErrors(source, false,false,false, options,"unknown 
configuration variable 'include-stylesheet'.\n\n");
+    }
+
+    @Test
+    public void testIncludeInheritanceDependenciesOnlyOption()
+    {
+        String[] imports = new String[]
+        {
+        };
+        String[] declarations = new String[]
+        {
+        };
+        String[] testCode = new String[]
+        {
+        };
+        String[] extra = new String[]
+        {
+        };
+        String source = getAS(imports, declarations, testCode, extra);
+
+        String[] options = new String[]
+        {
+            "-include-inheritance-dependencies-only=true"
+        };
+        compileAndExpectErrors(source, false,false,false, options,"unknown 
configuration variable 'include-inheritance-dependencies-only'.\n\n");
+    }
+}
\ No newline at end of file
diff --git a/compiler/src/test/resources/unit_tests/included.xml 
b/compiler/src/test/resources/unit_tests/included.xml
new file mode 100644
index 000000000..8db55ce52
--- /dev/null
+++ b/compiler/src/test/resources/unit_tests/included.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!--
+
+  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.
+
+-->
+<included>
+This file is for testing -include-file
+</included>
\ No newline at end of file
diff --git a/compiler/src/test/resources/unit_tests/stylesheet.css 
b/compiler/src/test/resources/unit_tests/stylesheet.css
new file mode 100644
index 000000000..40ea2ad10
--- /dev/null
+++ b/compiler/src/test/resources/unit_tests/stylesheet.css
@@ -0,0 +1,21 @@
+/*
+
+  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.
+
+*/
+MyClass {
+       color: #ff0000;
+}
\ No newline at end of file

Reply via email to