blob: a27a7338c1bba23c258a0389369efa5e2ae1cef4 [file] [log] [blame]
<?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="test-concat" basedir="." default="antunit"
xmlns:au="antlib:org.apache.ant.antunit">
<import file="../../antunit-base.xml" />
<property name="br" value="${line.separator}" />
<property name="world" value="World" />
<property name="out.dir" location="tempdir"/>
<target name="tearDown">
<delete dir="${out.dir}" quiet="true"/>
</target>
<target name="testCountEquals1">
<au:assertTrue>
<resourcecount count="1">
<concat>Hello, ${world}!</concat>
</resourcecount>
</au:assertTrue>
</target>
<target name="testReplacement">
<au:assertTrue>
<resourcesmatch>
<string>Hello, ${world}!</string>
<concat>Hello, ${world}!</concat>
</resourcesmatch>
</au:assertTrue>
</target>
<target name="testResources">
<au:assertTrue>
<resourcesmatch>
<string>foobarbaz</string>
<concat>
<string value="foo" />
<string value="bar" />
<string value="baz" />
</concat>
</resourcesmatch>
</au:assertTrue>
</target>
<target name="testFixLastLineResources">
<au:assertTrue>
<resourcesmatch>
<string>foo${line.separator}bar${line.separator}baz${line.separator}</string>
<concat fixlastline="true">
<string value="foo" />
<string value="bar" />
<string value="baz" />
</concat>
</resourcesmatch>
</au:assertTrue>
</target>
<target name="testEncoding">
<mkdir dir="${out.dir}"/>
<copy file="utf-16.in" toDir="${out.dir}" encoding="utf-16">
<filterchain>
<fixcrlf/>
</filterchain>
</copy>
<au:assertTrue>
<resourcesmatch astext="true">
<file file="${out.dir}/utf-16.in" />
<concat outputEncoding="utf-16">foo${br}bar${br}baz${br}</concat>
<concat outputEncoding="utf-16" fixlastline="true">
<string value="foo" />
<string value="bar" />
<string value="baz" />
</concat>
</resourcesmatch>
</au:assertTrue>
</target>
<target name="testFiltering">
<au:assertTrue>
<resourcesmatch astext="true">
<concat>foo${br}bar${br}baz${br}</concat>
<concat>
foo
#comment 1
bar
#comment 2
baz
#comment 3
<filterchain>
<striplinecomments>
<comment value="#" />
</striplinecomments>
<ignoreblank />
</filterchain>
</concat>
</resourcesmatch>
</au:assertTrue>
</target>
<target name="testReference">
<resources id="concat">
<concat>foo</concat>
</resources>
<au:assertTrue>
<and>
<resourcecount count="1" refid="concat" />
<resourcesmatch>
<string>foo</string>
<resources refid="concat" />
<!-- purposely hit it twice to see what happens -->
<resources refid="concat" />
</resourcesmatch>
</and>
</au:assertTrue>
</target>
</project>