| <?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="dirname-test" basedir="." default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
|
|
|
| <import file="../antunit-base.xml"/>
|
|
|
| <target name="test1">
|
| <au:expectfailure expectedmessage="property attribute required">
|
| <dirname/>
|
| </au:expectfailure>
|
| </target>
|
|
|
| <target name="test2">
|
| <au:expectfailure expectedmessage="file attribute required">
|
| <dirname property="propname"/>
|
| </au:expectfailure>
|
| </target>
|
|
|
| <target name="test3">
|
| <au:expectfailure expectedmessage="property attribute required">
|
| <dirname file="filename"/>
|
| </au:expectfailure>
|
| </target>
|
|
|
| <target name="init-test4">
|
| <condition property="valid.os">
|
| <and>
|
| <not><os family="dos"/></not><not><os family="netware"/></not>
|
| </and>
|
| </condition>
|
| </target>
|
|
|
| <target name="test4" depends="init-test4" if="valid.os">
|
| <dirname property="local.dir" file="/usr/local/foo.txt"/>
|
| <au:assertPropertyEquals name="local.dir"
|
| value="${file.separator}usr${file.separator}local"/>
|
| </target>
|
|
|
| <target name="test5">
|
| <dirname property="base.dir" file="foo.txt"/>
|
| <au:assertPropertyEquals name="base.dir" value="${basedir}"/>
|
| </target>
|
|
|
| </project>
|