fix 'and' task
Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/b8f6cf5e Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/b8f6cf5e Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/b8f6cf5e Branch: refs/heads/develop Commit: b8f6cf5ef9dd4071f308bd0d4285bc9364df763b Parents: 7794f18 Author: Alex Harui <[email protected]> Authored: Tue Apr 29 20:34:50 2014 -0700 Committer: Alex Harui <[email protected]> Committed: Tue Apr 29 20:34:50 2014 -0700 ---------------------------------------------------------------------- ant_on_air/src/org/apache/flex/ant/tags/And.as | 20 +++++++++------- ant_on_air/tests/subant.xml | 26 +++++++++++++++++++-- 2 files changed, 36 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b8f6cf5e/ant_on_air/src/org/apache/flex/ant/tags/And.as ---------------------------------------------------------------------- diff --git a/ant_on_air/src/org/apache/flex/ant/tags/And.as b/ant_on_air/src/org/apache/flex/ant/tags/And.as index eb824da..04c97c7 100644 --- a/ant_on_air/src/org/apache/flex/ant/tags/And.as +++ b/ant_on_air/src/org/apache/flex/ant/tags/And.as @@ -42,16 +42,20 @@ package org.apache.flex.ant.tags ant.processChildren(xml, this); if (numChildren > 0) { - var value:IValueTagHandler = getChildAt(0) as IValueTagHandler; - // get the value from the children - var val:Object = IValueTagHandler(value).getValue(context); - if (!(val == "true" || val == true)) - { - return false; - } + var n:int = numChildren; + for (var i:int = 0; i < n; i++) + { + var value:IValueTagHandler = getChildAt(i) as IValueTagHandler; + // get the value from the children + var val:Object = IValueTagHandler(value).getValue(context); + if (!(val == "true" || val == true)) + { + return false; + } + } return true; } - return false; + return false; } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b8f6cf5e/ant_on_air/tests/subant.xml ---------------------------------------------------------------------- diff --git a/ant_on_air/tests/subant.xml b/ant_on_air/tests/subant.xml index f4b5afc..2aebe8b 100644 --- a/ant_on_air/tests/subant.xml +++ b/ant_on_air/tests/subant.xml @@ -52,12 +52,34 @@ <isset property="env.FLEX_HOME" /> </and> </condition> - + + <condition property="should_fail" value="success" > + <and> + <matches string="foobar" pattern=".*bar" /> + <not> + <isset property="env.FLEX_HOME" /> + </not> + </and> + </condition> + <target name="subant"> <antcall target="paramtest"> <param name="foo" value="bar" /> </antcall> - <echo>subant reported ${success}</echo> + <echo>subant reported 'and' test 1: ${success} should be 'success'</echo> + <fail message="and test 1 failed" > + <condition> + <not> + <equals arg1="success" arg2="${success}" /> + </not> + </condition> + </fail> + <echo>subant reported 'and' test 2: ${should_fail} should not be defined</echo> + <fail message="and test 2 failed" > + <condition> + <equals arg1="success" arg2="${should_fail}" /> + </condition> + </fail> </target> <target name="paramtest">
