aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/ant/apache-ant-1.9.6/src/etc/testcases/taskdefs/concat.xml
blob: 235b15289a18d10c3019b71239b413c4dd438850 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?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="concat-test" basedir="." default="test1">

  <property name="tmp.file" value="concat.tmp" />
  <property name="tmp.file.2" value="concat.tmp.2" />

  <property name="world" value="World" />

  <target name="cleanup">
    <delete file="TESTDEST"/>
    <delete file="${tmp.file}"/>
    <delete file="${tmp.file.2}"/>
    <delete file="concat.line4"/>
    <delete file="concat.noeol"/>
    <delete file="concat.linecr"/>
    <delete file="concat.utf8"/>
    <delete file="concat.urls"/>
  </target>

  <target name="test1">
    <concat>
    </concat>
  </target>

  <target name="test2">
    <concat destfile="">Hello, ${world}!</concat>
  </target>

  <target name="test3">
    <concat destfile="${tmp.file}">Hello, ${world}!</concat>
  </target>

  <target name="test4">
    <concat destfile="${tmp.file.2}">
      <fileset dir="${basedir}" includes="${tmp.file}" />
      <filelist dir="${basedir}" files="${tmp.file},${tmp.file}" />
    </concat>
  </target>

  <target name="test5">
    <concat>Hello, ${world}!</concat>
  </target>

  <target name="test6">
    <concat destfile="TESTDEST" append="true">
      <filelist dir="${basedir}" files="thisfiledoesnotexist"/>
    </concat>
    <available file="TESTDEST" property="TESTDEST.was.created"/>
    <fail message="TESTDEST created for nonexistent files"
          if="TESTDEST.was.created"/>
  </target>

  <target name="testConcatNoNewline">
    <concat>
      <fileset dir="concat-input"/>
    </concat>
  </target>

  <target name="testConcatNoNewlineEncoding">
    <concat encoding="ASCII">
      <fileset dir="concat-input"/>
    </concat>
  </target>

  <target name="testPath">
    <concat destfile="${tmp.file.2}">
      <path path="${tmp.file}"/>
    </concat>
  </target>

  <target name="testAppend">
    <concat destfile="${tmp.file.2}">
      <path path="${tmp.file}"/>
    </concat>
    <concat destfile="${tmp.file.2}" append="true">
      <path path="${tmp.file}"/>
    </concat>
  </target>

  <target name="testfilter">
    <concat destfile="${tmp.file}">@REPLACEME@</concat>
    <concat>
      <path path="${tmp.file}"/>
      <filterchain>
        <replacetokens>
          <token key="REPLACEME" value="REPLACED"/>
        </replacetokens>
      </filterchain>
    </concat>
  </target>

  <target name="testnooverwrite">
    <touch file="${tmp.file.2}"/>
    <!-- concat.xml is now older than tmp.file.2
         so the following should not do anything -->
    <concat destfile="${tmp.file.2}" overwrite="false">
      <path path="concat.xml"/>
    </concat>
  </target>

  <target name="testoverwrite">
    <touch file="${tmp.file.2}"/>
    <!-- concat.xml is now older than tmp.file.2
         so the following should still overwrite it -->
    <concat destfile="${tmp.file.2}" overwrite="true">
      <path path="concat.xml"/>
    </concat>
  </target>

  <target name="testheaderfooter">
    <concat>
      <header filtering="false" trim="yes">
        header
      </header>
      <path path="${tmp.file}"/>
      <footer filtering="no">footer</footer>
    </concat>
  </target>

  <target name="testfileheader">
    <concat>
      <header file="${tmp.file}"/>
      <path path="${tmp.file}"/>
    </concat>
  </target>

  <target name="samefile">
    <touch file="${tmp.file}"/>
    <concat destfile="${tmp.file}">
      <path path="${tmp.file}"/>
    </concat>
  </target>

  <target name="testfilterinline">
    <concat>
      @REPLACEME@
      <filterchain>
        <replacetokens>
          <token key="REPLACEME" value="REPLACED"/>
        </replacetokens>
      </filterchain>
    </concat>
  </target>
  
  <target name="testmultireader">
    <concat destfile="${tmp.file}">Hello, World
    </concat>
    <concat destfile="${tmp.file.2}">Bye, World
    </concat>
    <concat>
      <path path="${tmp.file}"/>
      <path path="${tmp.file}"/>
      <path path="${tmp.file}"/>
      <path path="${tmp.file}"/>
      <path path="${tmp.file}"/>
      <path path="${tmp.file}"/>
      <path path="${tmp.file}"/>
      <path path="${tmp.file}"/>
      <path path="${tmp.file}"/>
      <!-- tailfilter seems to behave a little stange, place two
           here in case the implementation changes -->
      <path path="${tmp.file.2}"/>
      <path path="${tmp.file.2}"/>
      <filterchain>
        <tailfilter lines="2"/>
      </filterchain>
    </concat>
  </target>
  
  <target name="create-noel">
    <concat destfile="concat.noeol">This has no end of line</concat>
  </target>

  <target name="testfixlastline" depends="create-noel">
    <concat destfile="concat.line4" fixlastline="yes">
      <path path="concat.noeol"/>
      <path path="concat.noeol"/>
      <path path="concat.noeol"/>
      <path path="concat.noeol"/>
    </concat>
  </target>

  <target name="testfixlastlineeol" depends="create-noel">
    <concat destfile="concat.linecr" fixlastline="yes" eol="mac">
      <path path="concat.noeol"/>
      <path path="concat.noeol"/>
    </concat>
  </target>

  <target name="testTranscoding">
    <concat destfile="concat.utf8"
            encoding="ISO8859_1" outputencoding="UTF8">
      <path path="copy/input/iso8859-1"/>
    </concat>
  </target>

</project>