| <?xml version="1.0"?> |
| |
| <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" /> |
| |
| <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" if="os.unix"> |
| <au:assertTrue> |
| <resourcesmatch astext="true"> |
| <file file="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="testEncodingWindows" if="os.windows"> |
| <au:assertTrue> |
| <resourcesmatch astext="true"> |
| <file file="utf-16.in.windows" /> |
| <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> |