diff options
author | Matt Benson <mbenson@apache.org> | 2022-02-24 14:36:56 -0600 |
---|---|---|
committer | Matt Benson <mbenson@apache.org> | 2022-02-24 14:36:56 -0600 |
commit | 137218fd6a4f7ff18a1eb26e173505d35c5be7d9 (patch) | |
tree | b0767b8b4b29e9bc589e788905faf85e406918b8 | |
parent | 3d83934603c1f9036ed548eda37a633f68077766 (diff) | |
download | ant-137218fd6a4f7ff18a1eb26e173505d35c5be7d9.tar.gz |
test script properties binding
-rw-r--r-- | src/tests/antunit/taskdefs/optional/script/script-test.xml | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/tests/antunit/taskdefs/optional/script/script-test.xml b/src/tests/antunit/taskdefs/optional/script/script-test.xml new file mode 100644 index 000000000..a003c2f08 --- /dev/null +++ b/src/tests/antunit/taskdefs/optional/script/script-test.xml @@ -0,0 +1,70 @@ +<?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 + + https://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 default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> + <import file="../../../antunit-base.xml" /> + + <target name="setUp"> + <condition property="expect-js"> + <not> + <and> + <isset property="jenkins" /> + <javaversion atleast="15" /> + </and> + </not> + </condition> + <echo>$${expect-js}=${expect-js}</echo> + </target> + + <target name="test-available-property-default" depends="setUp" if="expect-js"> + <property name="foo" value="FOO" /> + <script language="javascript"> + project.setProperty('bar', foo); + </script> + <au:assertEquals expected="${foo}" actual="${bar}" /> + </target> + + <target name="test-available-property-setbeans-false" depends="setUp" if="expect-js"> + <property name="baz" value="BAZ" /> + <au:expectfailure> + <script language="javascript" setbeans="false"> + project.log(nosuch); + var b = (baz == project.getProperty('baz')); + </script> + </au:expectfailure> + </target> + + <target name="test-available-local-property" depends="setUp" if="expect-js"> + <local name="localproperty" /> + <property name="localproperty" value="iamlocal" /> + <script language="javascript"> + if (localproperty != project.getProperty('localproperty')) throw new org.apache.tools.ant.BuildException(); + </script> + </target> + + <target name="test-shaded-local-property" depends="setUp" if="expect-js"> + <property name="shademe" value="FOO" /> + <sequential> + <local name="shademe" /> + <property name="shademe" value="BAR" /> + <script language="javascript"> + if (shademe != project.getProperty('shademe')) throw new org.apache.tools.ant.BuildException(); + </script> + </sequential> + </target> + +</project> |