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

mbenson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git


The following commit(s) were added to refs/heads/master by this push:
     new 137218f  test script properties binding
137218f is described below

commit 137218fd6a4f7ff18a1eb26e173505d35c5be7d9
Author: Matt Benson <mben...@apache.org>
AuthorDate: Thu Feb 24 14:36:56 2022 -0600

    test script properties binding
---
 .../taskdefs/optional/script/script-test.xml       | 70 ++++++++++++++++++++++
 1 file changed, 70 insertions(+)

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 0000000..a003c2f
--- /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>

Reply via email to