aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/ant/apache-ant-1.9.6/src/etc/testcases/types/selectors/scriptselector.xml
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/ant/apache-ant-1.9.6/src/etc/testcases/types/selectors/scriptselector.xml')
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/etc/testcases/types/selectors/scriptselector.xml138
1 files changed, 138 insertions, 0 deletions
diff --git a/framework/src/ant/apache-ant-1.9.6/src/etc/testcases/types/selectors/scriptselector.xml b/framework/src/ant/apache-ant-1.9.6/src/etc/testcases/types/selectors/scriptselector.xml
new file mode 100644
index 00000000..80afe309
--- /dev/null
+++ b/framework/src/ant/apache-ant-1.9.6/src/etc/testcases/types/selectors/scriptselector.xml
@@ -0,0 +1,138 @@
+<?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.
+-->
+<project name="scriptselector" default="def" basedir=".">
+
+ <property name="src.file" location="${ant.file}" />
+
+ <macrodef name="testselected">
+ <element name="selector" implicit="yes" optional="true"/>
+ <attribute name="message"/>
+ <sequential>
+ <fail message="@{message} failed: file was not selected">
+ <condition>
+ <not>
+ <isfileselected file="{src.file}">
+ <selector/>
+ </isfileselected>
+ </not>
+ </condition>
+ </fail>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="testnoselected">
+ <element name="selector" implicit="yes" optional="true"/>
+ <attribute name="message"/>
+ <sequential>
+ <fail message="@{message} failed: file was selected">
+ <condition>
+ <isfileselected file="{src.file}">
+ <selector/>
+ </isfileselected>
+ </condition>
+ </fail>
+ </sequential>
+ </macrodef>
+
+ <!-- this is here to test the macro is well coded -->
+ <target name="testNoSelector">
+ <testselected message="testNoSelector" >
+ </testselected>
+ </target>
+
+ <target name="testNolanguage">
+ <testselected message="testNolanguage" >
+ <selector>
+ <scriptselector >
+ self.setSelected(true);
+ </scriptselector>
+ </selector>
+ </testselected>
+ </target>
+
+ <target name="testSelectionSetByDefault">
+ <testselected message="testSelectionSetByDefault" >
+ <selector>
+ <scriptselector language="javascript">
+ </scriptselector>
+ </selector>
+ </testselected>
+ </target>
+
+
+ <target name="testSelectionSetWorks">
+ <testselected message="testSelectionSetWorks" >
+ <selector>
+ <scriptselector language="javascript">
+ self.setSelected(false);
+ self.setSelected(true);
+ </scriptselector>
+ </selector>
+ </testselected>
+ </target>
+
+ <target name="testSelectionClearWorks">
+ <testnoselected message="testSelectionClearWorks">
+ <selector>
+ <scriptselector language="javascript">
+ self.setSelected(false);
+ </scriptselector>
+ </selector>
+ </testnoselected>
+ </target>
+
+ <target name="testFileAttribute">
+ <testselected message="testFileAttribute" >
+ <selector>
+ <scriptselector language="javascript">
+ self.setSelected(file.equals(self.getFile()));
+ </scriptselector>
+ </selector>
+ </testselected>
+ </target>
+
+ <target name="testFilenameAttribute">
+ <testselected message="testFilenameAttribute" >
+ <selector>
+ <scriptselector language="javascript">
+ self.setSelected(filename.equals(self.getFilename()));
+ </scriptselector>
+ </selector>
+ </testselected>
+ </target>
+
+ <target name="testBasedirAttribute">
+ <testselected message="testBasedirAttribute" >
+ <selector>
+ <scriptselector language="javascript">
+ self.setSelected(basedir.equals(self.getBasedir()));
+ </scriptselector>
+ </selector>
+ </testselected>
+ </target>
+
+ <target name="notestFilenameLength">
+ <testselected message="notestFilenameLength" >
+ <selector>
+ <scriptselector language="javascript">
+ self.setSelected((filename.length%2)==0);
+ </scriptselector>
+ </selector>
+ </testselected>
+ </target>
+</project>