Return-Path: Let's begin with a simple model: Hello, world! Cool, now get into the first model. This implements a scalar, list, and
+hash as a single class. Let's try some tests... MultiModel1 as a string! Now as a list... Index into a list... Model1 value: 1 List size is: Nasty! List size is: Nasty! Now, again, as a hash. First using dot notation, then using [] notation: Selftest of a hash from MultiModel1 Selftest of a hash from MultiModel1 Now for the tricky stuff... use a model to index into another model... selftest Selftest of a hash from MultiModel1 self Selftest of a hash from MultiModel1 Same thing, this time a List index... 0 Model1 value: 0 Model1 value: 1 Now, do the same recursively... MultiModel1 as a string! Model2 is alive! Arguments are: Arguments are: Does this really not work? Model3 is alive! Selftest from MultiModel3! Hello world from MultiModel3! (Again, with Hashes) Model3 is alive! Selftest from MultiModel3! Model3 is alive! Selftest from MultiModel3! Selftest from MultiModel3! As I suspected! (Manual on Expressions needs updating.) Second test on list size Key size, not the listSize method. Key size, not the listSize method. A simple test follows: Hello, world! A simple test follows: Hello, world!
+ Message exists!
+ ...and even generates output!
+ <#if message>
+ Nested statements are ok, too.
+ #if>
+ A simple test follows: Hello, world! Now perform a number assignment: Now use numbers in assignment Try numbers in tests
+Model1 value: 1
+Model1 value: 2
+Model1 value: 3
+Model1 value: 4
+Model1 value: 5
+Model1 value: 6
+Model1 value: 7
+Model1 value: 8
+Model1 value: 9
+Model3 is alive!
+
+
test
MultiModel1 as a string!
Selftest of a hash from MultiModel1
Hello, world!
Numbers in hashes:
+ +twelve +twelve +twelve + + +Numbers in method calls:
+ +Single argument value is: 1 +Single argument value is: 1 +Single argument value is: 12 +Single argument value is: 3 +Single argument value is: 3 + + + http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/number-to-date.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/number-to-date.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/number-to-date.txt new file mode 100644 index 0000000..bc8a10e --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/number-to-date.txt @@ -0,0 +1,31 @@ +/* + * 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. + */ +2011-05-16T19:47:55.54Z == 2011-05-16T19:47:55.54Z +2011-05-16 == 2011-05-16 +19:47:55.54Z == 19:47:55.54Z + +2011-05-16T19:47:55.54Z == 2011-05-16T19:47:55.54Z +2011-05-16T19:47:55.54Z == 2011-05-16T19:47:55.54Z +2011-05-16T19:47:55.54Z == 2011-05-16T19:47:55.54Z +2011-05-16T19:47:55.54Z == 2011-05-16T19:47:55.54Z +1970-01-01T00:00:01Z == 1970-01-01T00:00:01Z +1970-01-01T00:00:01Z == 1970-01-01T00:00:01Z +1970-01-01T00:00:00Z == 1970-01-01T00:00:00Z + +failed http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/numerical-cast.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/numerical-cast.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/numerical-cast.txt new file mode 100644 index 0000000..3bf6cd0 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/numerical-cast.txt @@ -0,0 +1,462 @@ +/* + * 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. + */ + +?int: + 0?int=0 + 1?int=1 + -1?int=-1 + 0.5?int=0 + 1.5?int=1 + -0.5?int=0 + -1.5?int=-1 + 0.25?int=0 + -0.25?int=0 + 1.75?int=1 + -1.75?int=-1 + 1.01?int=1 + -1.01?int=-1 + 0.01?int=0 + -0.01?int=0 + 127?int=127 + 128?int=128 + -127?int=-127 + -128?int=-128 + 32767?int=32767 + 32768?int=32768 + -32767?int=-32767 + -32768?int=-32768 + 2147483647?int=2147483647 + 2147483648?int=-2147483648 + -2147483647?int=-2147483647 + -2147483648?int=-2147483648 + 4294967295?int=-1 + 4294967296?int=0 + -4294967295?int=1 + -4294967296?int=0 + 2147483647.1?int=2147483647 + 2147483648.1?int=-2147483648 + -2147483647.1?int=-2147483647 + -2147483648.1?int=-2147483648 + 4294967295.1?int=-1 + 4294967296.1?int=0 + -4294967295.1?int=1 + -4294967296.1?int=0 + 2147483647.5?int=2147483647 + 2147483648.5?int=-2147483648 + -2147483647.5?int=-2147483647 + -2147483648.5?int=-2147483648 + 4294967295.5?int=-1 + 4294967296.5?int=0 + -4294967295.5?int=1 + -4294967296.5?int=0 + +?double + 0?double=0 + 1?double=1 + -1?double=-1 + 0.5?double=0.5 + 1.5?double=1.5 + -0.5?double=-0.5 + -1.5?double=-1.5 + 0.25?double=0.25 + -0.25?double=-0.25 + 1.75?double=1.75 + -1.75?double=-1.75 + 1.01?double=1.01 + -1.01?double=-1.01 + 0.01?double=0.01 + -0.01?double=-0.01 + 127?double=127 + 128?double=128 + -127?double=-127 + -128?double=-128 + 32767?double=32767 + 32768?double=32768 + -32767?double=-32767 + -32768?double=-32768 + 2147483647?double=2147483647 + 2147483648?double=2147483648 + -2147483647?double=-2147483647 + -2147483648?double=-2147483648 + 4294967295?double=4294967295 + 4294967296?double=4294967296 + -4294967295?double=-4294967295 + -4294967296?double=-4294967296 + 2147483647.1?double=2147483647.1 + 2147483648.1?double=2147483648.1 + -2147483647.1?double=-2147483647.1 + -2147483648.1?double=-2147483648.1 + 4294967295.1?double=4294967295.1 + 4294967296.1?double=4294967296.1 + -4294967295.1?double=-4294967295.1 + -4294967296.1?double=-4294967296.1 + 2147483647.5?double=2147483647.5 + 2147483648.5?double=2147483648.5 + -2147483647.5?double=-2147483647.5 + -2147483648.5?double=-2147483648.5 + 4294967295.5?double=4294967295.5 + 4294967296.5?double=4294967296.5 + -4294967295.5?double=-4294967295.5 + -4294967296.5?double=-4294967296.5 + +?long + 0?long=0 + 1?long=1 + -1?long=-1 + 0.5?long=0 + 1.5?long=1 + -0.5?long=0 + -1.5?long=-1 + 0.25?long=0 + -0.25?long=0 + 1.75?long=1 + -1.75?long=-1 + 1.01?long=1 + -1.01?long=-1 + 0.01?long=0 + -0.01?long=0 + 127?long=127 + 128?long=128 + -127?long=-127 + -128?long=-128 + 32767?long=32767 + 32768?long=32768 + -32767?long=-32767 + -32768?long=-32768 + 2147483647?long=2147483647 + 2147483648?long=2147483648 + -2147483647?long=-2147483647 + -2147483648?long=-2147483648 + 4294967295?long=4294967295 + 4294967296?long=4294967296 + -4294967295?long=-4294967295 + -4294967296?long=-4294967296 + 2147483647.1?long=2147483647 + 2147483648.1?long=2147483648 + -2147483647.1?long=-2147483647 + -2147483648.1?long=-2147483648 + 4294967295.1?long=4294967295 + 4294967296.1?long=4294967296 + -4294967295.1?long=-4294967295 + -4294967296.1?long=-4294967296 + 2147483647.5?long=2147483647 + 2147483648.5?long=2147483648 + -2147483647.5?long=-2147483647 + -2147483648.5?long=-2147483648 + 4294967295.5?long=4294967295 + 4294967296.5?long=4294967296 + -4294967295.5?long=-4294967295 + -4294967296.5?long=-4294967296 + +?long from date + 1304877615000 = 1304877615000 + +?float + 0?float=0 + 1?float=1 + -1?float=-1 + 0.5?float=0.5 + 1.5?float=1.5 + -0.5?float=-0.5 + -1.5?float=-1.5 + 0.25?float=0.25 + -0.25?float=-0.25 + 1.75?float=1.75 + -1.75?float=-1.75 + 1.01?float=1.00999999 + -1.01?float=-1.00999999 + 0.01?float=0.01 + -0.01?float=-0.01 + 127?float=127 + 128?float=128 + -127?float=-127 + -128?float=-128 + 32767?float=32767 + 32768?float=32768 + -32767?float=-32767 + -32768?float=-32768 + 2147483647?float=2147483648 + 2147483648?float=2147483648 + -2147483647?float=-2147483648 + -2147483648?float=-2147483648 + 4294967295?float=4294967296 + 4294967296?float=4294967296 + -4294967295?float=-4294967296 + -4294967296?float=-4294967296 + 2147483647.1?float=2147483648 + 2147483648.1?float=2147483648 + -2147483647.1?float=-2147483648 + -2147483648.1?float=-2147483648 + 4294967295.1?float=4294967296 + 4294967296.1?float=4294967296 + -4294967295.1?float=-4294967296 + -4294967296.1?float=-4294967296 + 2147483647.5?float=2147483648 + 2147483648.5?float=2147483648 + -2147483647.5?float=-2147483648 + -2147483648.5?float=-2147483648 + 4294967295.5?float=4294967296 + 4294967296.5?float=4294967296 + -4294967295.5?float=-4294967296 + -4294967296.5?float=-4294967296 + +?byte + 0?byte=0 + 1?byte=1 + -1?byte=-1 + 0.5?byte=0 + 1.5?byte=1 + -0.5?byte=0 + -1.5?byte=-1 + 0.25?byte=0 + -0.25?byte=0 + 1.75?byte=1 + -1.75?byte=-1 + 1.01?byte=1 + -1.01?byte=-1 + 0.01?byte=0 + -0.01?byte=0 + 127?byte=127 + 128?byte=-128 + -127?byte=-127 + -128?byte=-128 + 32767?byte=-1 + 32768?byte=0 + -32767?byte=1 + -32768?byte=0 + 2147483647?byte=-1 + 2147483648?byte=0 + -2147483647?byte=1 + -2147483648?byte=0 + 4294967295?byte=-1 + 4294967296?byte=0 + -4294967295?byte=1 + -4294967296?byte=0 + 2147483647.1?byte=-1 + 2147483648.1?byte=0 + -2147483647.1?byte=1 + -2147483648.1?byte=0 + 4294967295.1?byte=-1 + 4294967296.1?byte=0 + -4294967295.1?byte=1 + -4294967296.1?byte=0 + 2147483647.5?byte=-1 + 2147483648.5?byte=0 + -2147483647.5?byte=1 + -2147483648.5?byte=0 + 4294967295.5?byte=-1 + 4294967296.5?byte=0 + -4294967295.5?byte=1 + -4294967296.5?byte=0 + +?short + 0?short=0 + 1?short=1 + -1?short=-1 + 0.5?short=0 + 1.5?short=1 + -0.5?short=0 + -1.5?short=-1 + 0.25?short=0 + -0.25?short=0 + 1.75?short=1 + -1.75?short=-1 + 1.01?short=1 + -1.01?short=-1 + 0.01?short=0 + -0.01?short=0 + 127?short=127 + 128?short=128 + -127?short=-127 + -128?short=-128 + 32767?short=32767 + 32768?short=-32768 + -32767?short=-32767 + -32768?short=-32768 + 2147483647?short=-1 + 2147483648?short=0 + -2147483647?short=1 + -2147483648?short=0 + 4294967295?short=-1 + 4294967296?short=0 + -4294967295?short=1 + -4294967296?short=0 + 2147483647.1?short=-1 + 2147483648.1?short=0 + -2147483647.1?short=1 + -2147483648.1?short=0 + 4294967295.1?short=-1 + 4294967296.1?short=0 + -4294967295.1?short=1 + -4294967296.1?short=0 + 2147483647.5?short=-1 + 2147483648.5?short=0 + -2147483647.5?short=1 + -2147483648.5?short=0 + 4294967295.5?short=-1 + 4294967296.5?short=0 + -4294967295.5?short=1 + -4294967296.5?short=0 + +?floor + 0?floor=0 + 1?floor=1 + -1?floor=-1 + 0.5?floor=0 + 1.5?floor=1 + -0.5?floor=-1 + -1.5?floor=-2 + 0.25?floor=0 + -0.25?floor=-1 + 1.75?floor=1 + -1.75?floor=-2 + 1.01?floor=1 + -1.01?floor=-2 + 0.01?floor=0 + -0.01?floor=-1 + 127?floor=127 + 128?floor=128 + -127?floor=-127 + -128?floor=-128 + 32767?floor=32767 + 32768?floor=32768 + -32767?floor=-32767 + -32768?floor=-32768 + 2147483647?floor=2147483647 + 2147483648?floor=2147483648 + -2147483647?floor=-2147483647 + -2147483648?floor=-2147483648 + 4294967295?floor=4294967295 + 4294967296?floor=4294967296 + -4294967295?floor=-4294967295 + -4294967296?floor=-4294967296 + 2147483647.1?floor=2147483647 + 2147483648.1?floor=2147483648 + -2147483647.1?floor=-2147483648 + -2147483648.1?floor=-2147483649 + 4294967295.1?floor=4294967295 + 4294967296.1?floor=4294967296 + -4294967295.1?floor=-4294967296 + -4294967296.1?floor=-4294967297 + 2147483647.5?floor=2147483647 + 2147483648.5?floor=2147483648 + -2147483647.5?floor=-2147483648 + -2147483648.5?floor=-2147483649 + 4294967295.5?floor=4294967295 + 4294967296.5?floor=4294967296 + -4294967295.5?floor=-4294967296 + -4294967296.5?floor=-4294967297 + +?ceiling + 0?ceiling=0 + 1?ceiling=1 + -1?ceiling=-1 + 0.5?ceiling=1 + 1.5?ceiling=2 + -0.5?ceiling=0 + -1.5?ceiling=-1 + 0.25?ceiling=1 + -0.25?ceiling=0 + 1.75?ceiling=2 + -1.75?ceiling=-1 + 1.01?ceiling=2 + -1.01?ceiling=-1 + 0.01?ceiling=1 + -0.01?ceiling=0 + 127?ceiling=127 + 128?ceiling=128 + -127?ceiling=-127 + -128?ceiling=-128 + 32767?ceiling=32767 + 32768?ceiling=32768 + -32767?ceiling=-32767 + -32768?ceiling=-32768 + 2147483647?ceiling=2147483647 + 2147483648?ceiling=2147483648 + -2147483647?ceiling=-2147483647 + -2147483648?ceiling=-2147483648 + 4294967295?ceiling=4294967295 + 4294967296?ceiling=4294967296 + -4294967295?ceiling=-4294967295 + -4294967296?ceiling=-4294967296 + 2147483647.1?ceiling=2147483648 + 2147483648.1?ceiling=2147483649 + -2147483647.1?ceiling=-2147483647 + -2147483648.1?ceiling=-2147483648 + 4294967295.1?ceiling=4294967296 + 4294967296.1?ceiling=4294967297 + -4294967295.1?ceiling=-4294967295 + -4294967296.1?ceiling=-4294967296 + 2147483647.5?ceiling=2147483648 + 2147483648.5?ceiling=2147483649 + -2147483647.5?ceiling=-2147483647 + -2147483648.5?ceiling=-2147483648 + 4294967295.5?ceiling=4294967296 + 4294967296.5?ceiling=4294967297 + -4294967295.5?ceiling=-4294967295 + -4294967296.5?ceiling=-4294967296 + +?round + 0?round=0 + 1?round=1 + -1?round=-1 + 0.5?round=1 + 1.5?round=2 + -0.5?round=0 + -1.5?round=-1 + 0.25?round=0 + -0.25?round=0 + 1.75?round=2 + -1.75?round=-2 + 1.01?round=1 + -1.01?round=-1 + 0.01?round=0 + -0.01?round=0 + 127?round=127 + 128?round=128 + -127?round=-127 + -128?round=-128 + 32767?round=32767 + 32768?round=32768 + -32767?round=-32767 + -32768?round=-32768 + 2147483647?round=2147483647 + 2147483648?round=2147483648 + -2147483647?round=-2147483647 + -2147483648?round=-2147483648 + 4294967295?round=4294967295 + 4294967296?round=4294967296 + -4294967295?round=-4294967295 + -4294967296?round=-4294967296 + 2147483647.1?round=2147483647 + 2147483648.1?round=2147483648 + -2147483647.1?round=-2147483647 + -2147483648.1?round=-2147483648 + 4294967295.1?round=4294967295 + 4294967296.1?round=4294967296 + -4294967295.1?round=-4294967295 + -4294967296.1?round=-4294967296 + 2147483647.5?round=2147483648 + 2147483648.5?round=2147483649 + -2147483647.5?round=-2147483647 + -2147483648.5?round=-2147483648 + 4294967295.5?round=4294967296 + 4294967296.5?round=4294967297 + -4294967295.5?round=-4294967295 + -4294967296.5?round=-4294967296 http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/output-encoding1.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/output-encoding1.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/output-encoding1.txt new file mode 100644 index 0000000..3b5215a --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/output-encoding1.txt @@ -0,0 +1,27 @@ +/* + * 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. + */ +Output charset: UTF-8 +URL escaping charset: undefined + +a%FE%FF%00%2F%00%25b +a%FE%FF%00%2F%00%25b +a%2F%25b +a%2F%25b +a%FE%FF%00%2F%00%25b +a%2F%25b \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/output-encoding2.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/output-encoding2.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/output-encoding2.txt new file mode 100644 index 0000000..6956b6c Binary files /dev/null and b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/output-encoding2.txt differ http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/output-encoding3.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/output-encoding3.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/output-encoding3.txt new file mode 100644 index 0000000..c0369f6 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/output-encoding3.txt @@ -0,0 +1,26 @@ +/* + * 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. + */ +Output charset: ISO-8859-1 +URL escaping charset: UTF-16 + +UTF-16: a%FE%FF%00%2F%00%25b +ISO-8859-1: a%2F%25b +UTF-16: a%FE%FF%00%2F%00%25b +ISO-8859-1: a%2F%25b +ISO-8859-1: a%2F%25b \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/precedence.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/precedence.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/precedence.txt new file mode 100644 index 0000000..b19cb31 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/precedence.txt @@ -0,0 +1,48 @@ +/* + * 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. + */ + + +A simple test follows:
+ +Hello, world!
+ +Access the same variable via the root variable (dot syntax):
+ +Hello, world!
+ +Access the same variable via the root variable (bracket syntax):
+ +Hello, world!
+ +Ensure that root lookups are unaffected by local variables:
+ + + Hello, world! + Hello, world! Part Deux + + + http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/sequence-builtins.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/sequence-builtins.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/sequence-builtins.txt new file mode 100644 index 0000000..4f7796a --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/sequence-builtins.txt @@ -0,0 +1,404 @@ +/* + * 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. + */ +Sorting scalars: +---------------- + +String order: +- aardvark +- Barbara +- beetroot +- whale +- zeppelin + +First: aardvark +Last: zeppelin +Size 5 + +Numerical order: +- -324 +- -34 +- 0 +- 0.1 +- 0.11 +- 1 +- 5 +- 111 +- 123 +- 543 + +First: -324 +Last: 543 +Size 10 + +Date/time order: +- 06:05 +- 08:05 +- 08:15 +- 18:00 + +Boolean order: +- false +- false +- true +- true + + +Sorting hashes: +--------------- + +Order by name: +- aardvark: 30 +- Barbara: 53 +- beetroot: 0.3 +- whale: 2000 +- zeppelin: -200 + +Order by weight: +- zeppelin: -200 +- beetroot: 0.3 +- aardvark: 30 +- Barbara: 53 +- whale: 2000 + +Order by a.x.v: +- aqweqw +- dfgdf +- qweqw +- utyu + +Order by a.y, which is a date: +- 1998-02-20 +- 1999-01-20 +- 1999-04-19 +- 1999-04-20 + +Reverse: +-------- + +Order by weight desc: +- whale: 2000 +- Barbara: 53 +- aardvark: 30 +- beetroot: 0.3 +- zeppelin: -200 + +Order by weight desc desc: +- zeppelin: -200 +- beetroot: 0.3 +- aardvark: 30 +- Barbara: 53 +- whale: 2000 + +Order by weight desc desc desc: +- whale: 2000 +- Barbara: 53 +- aardvark: 30 +- beetroot: 0.3 +- zeppelin: -200 + +Contains: +--------- + +True: +true +true +true +true +true +true +true + +False: +false +false +false +false +false +false +false + +False: false + +Index_of: +--------- + +0 = 0 +1 = 1 +2 = 2 +6 = 6 +0 = 0 +1 = 1 +2 = 2 + +-1 = -1 +-1 = -1 +-1 = -1 +-1 = -1 +-1 = -1 +-1 = -1 +-1 = -1 + +-1 = -1 + +Last_index_of: +-------------- + +6 = 6 +1 = 1 +2 = 2 +7 = 7 +-1 = -1 +0 = 0 +1 = 1 +2 = 2 +-1 = -1 + +Index_of and last_index_of with starting indices +------------------------------------------------ + +seq_index_of "Joe": +0 = 0 +0 = 0 +0 = 0 +2 = 2 +2 = 2 +-1 = -1 +-1 = -1 + +seq_last_index_of "Joe": +-1 = -1 +-1 = -1 +0 = 0 +0 = 0 +2 = 2 +2 = 2 +2 = 2 + +seq_index_of "Susan": +3 = 3 +3 = 3 +3 = 3 +3 = 3 +3 = 3 +3 = 3 +-1 = -1 + +seq_last_index_of "Susan": +-1 = -1 +-1 = -1 +-1 = -1 +-1 = -1 +-1 = -1 +3 = 3 +3 = 3 + +seq_index_of "a": +0 = 0 +0 = 0 +0 = 0 +-1 = -1 +-1 = -1 +-1 = -1 +-1 = -1 + +seq_index_of "b": +1 = 1 +1 = 1 +1 = 1 +1 = 1 +-1 = -1 +-1 = -1 + +seq_index_of "c": +2 = 2 +2 = 2 +2 = 2 +2 = 2 +2 = 2 +-1 = -1 + +seq_last_index_of "a": +-1 = -1 +-1 = -1 +0 = 0 +0 = 0 +0 = 0 +0 = 0 +0 = 0 + +seq_last_index_of "b": +-1 = -1 +-1 = -1 +-1 = -1 +1 = 1 +1 = 1 +1 = 1 + +seq_last_index_of "c": +-1 = -1 +-1 = -1 +-1 = -1 +-1 = -1 +2 = 2 +2 = 2 + +Sequence builtins ignoring nulls +-------------------------------- + +true = true +2 = 2 +0 = 0 + +These should throw exception, but for BC they don't: +false = false +-1 = -1 +-1 = -1 + +Sequence built-ins failing on date-type mismatch +------------------------------------------------ + + +Chunk +----- + +columns = 1, fill = NULL: + Rows: 7 + a <-- Columns: 1 + b <-- Columns: 1 + c <-- Columns: 1 + d <-- Columns: 1 + e <-- Columns: 1 + f <-- Columns: 1 + g <-- Columns: 1 + +columns = 2, fill = NULL: + Rows: 4 + a b <-- Columns: 2 + c d <-- Columns: 2 + e f <-- Columns: 2 + g <-- Columns: 1 + +columns = 3, fill = NULL: + Rows: 3 + a b c <-- Columns: 3 + d e f <-- Columns: 3 + g <-- Columns: 1 + +columns = 4, fill = NULL: + Rows: 2 + a b c d <-- Columns: 4 + e f g <-- Columns: 3 + +columns = 5, fill = NULL: + Rows: 2 + a b c d e <-- Columns: 5 + f g <-- Columns: 2 + +columns = 10, fill = NULL: + Rows: 1 + a b c d e f g <-- Columns: 7 + +columns = 1, fill = -: + Rows: 7 + a <-- Columns: 1 + b <-- Columns: 1 + c <-- Columns: 1 + d <-- Columns: 1 + e <-- Columns: 1 + f <-- Columns: 1 + g <-- Columns: 1 + +columns = 2, fill = -: + Rows: 4 + a b <-- Columns: 2 + c d <-- Columns: 2 + e f <-- Columns: 2 + g - <-- Columns: 2 + +columns = 3, fill = -: + Rows: 3 + a b c <-- Columns: 3 + d e f <-- Columns: 3 + g - - <-- Columns: 3 + +columns = 4, fill = -: + Rows: 2 + a b c d <-- Columns: 4 + e f g - <-- Columns: 4 + +columns = 5, fill = -: + Rows: 2 + a b c d e <-- Columns: 5 + f g - - - <-- Columns: 5 + +columns = 10, fill = -: + Rows: 1 + a b c d e f g - - - <-- Columns: 10 + +columns = 3, fill = NULL: + Rows: 3 + 1 2 3 <-- Columns: 3 + 4 5 6 <-- Columns: 3 + 7 8 9 <-- Columns: 3 + +columns = 3, fill = -: + Rows: 3 + 1 2 3 <-- Columns: 3 + 4 5 6 <-- Columns: 3 + 7 8 9 <-- Columns: 3 + +columns = 3, fill = NULL: + Rows: 1 + 1 <-- Columns: 1 + +columns = 3, fill = -: + Rows: 1 + 1 - - <-- Columns: 3 + +columns = 3, fill = NULL: + Rows: 0 + +columns = 3, fill = -: + Rows: 0 + + + + +Join +---- + +- 1, two, three, 4 +- +- 1, two, three, 4. +- (empty) +- a, c +- a, c +- a, c. +- +- (empty) +- (empty) +- a, b, c. +- a, b, c. + + +Misc +---- + +First of set 1: a +First of set 2: a \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/specialvars.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/specialvars.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/specialvars.txt new file mode 100644 index 0000000..e2fa13e --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/specialvars.txt @@ -0,0 +1,25 @@ +/* + * 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. + */ +en == en +en_US == en_US +utf-8 == utf-8 +specialvars.ftl == specialvars.ftl +iso-8859-1 == iso-8859-1 +x == x +true == true \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins-regexps-matches.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins-regexps-matches.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins-regexps-matches.txt new file mode 100644 index 0000000..ba14e7f --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins-regexps-matches.txt @@ -0,0 +1,99 @@ +/* + * 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. + */ + +List mode: +Size: 4 +[L16][L27][L38][L49] +[L16][L27][L38][L49] + +Iterator mode: +[L16][L27][L38][L49] +[L16(L16, L27, L38, L49)][L27(L16, L27, L38, L49)][L38(L16, L27, L38, L49)][L49(L16, L27, L38, L49)] +[L16][L27][L38][L49] + +Iterator mode changes to list mode: +[L16]/4[L27]/4[L38]/4[L49]/4 +[L16][L27][L38][L49] + +Iterator mode changes to list mode 2: +[L16][L27][L38][L49] +[L16]/4[L27]/4[L38]/4[L49]/4 + +List mode with embedded iteration: +[L16(L16, L27, L38, L49)][L27(L16, L27, L38, L49)][L38(L16, L27, L38, L49)][L49(L16, L27, L38, L49)] + +Entire input match: +- M: L16 + - G: L16 + - G: 1 + - G: 6 +- M: L27 + - G: L27 + - G: 2 + - G: 7 +- M: L38 + - G: L38 + - G: 3 + - G: 8 +- M: L49 + - G: L49 + - G: 4 + - G: 9 +firstGS was: L16, 1, 6 + +Entire input match 2: +Matches: true +- G: x12 +- G: 1 +- G: 2 +As list: +- M: x12 + - G: x12 + - G: 1 + - G: 2 +Groups again: +- G: x12 +- G: 1 +- G: 2 + +Entire input match 3: +Matches: false + +Entire input match 4: +Matches: true +- G: x12 +- G: 1 +- G: 2 + +Substring match nested into entire input match: +- G: x12 ([x12{x12, 1, 2}]) +- G: 1 ([x12{x12, 1, 2}]) +- G: 2 ([x12{x12, 1, 2}]) + +Different entire input and substring matches: +123, 123 +- M: 1 (Gs: 1, 1) +- M: 2 (Gs: 2, 2) +- M: 3 (Gs: 3, 3) + +Different entire input and substring matches 2: +123 +- M: 1 (Gs: 1) +- M: 2 (Gs: 2) +- M: 3 (Gs: 3) http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins-regexps.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins-regexps.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins-regexps.txt new file mode 100644 index 0000000..c54dc96 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins-regexps.txt @@ -0,0 +1,112 @@ +/* + * 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. + */ +true == true +true == true + +false == false +true == true + +false == false +true == true + +false == false +true == true + +false == false +false == false +false == false +true == true +true == true +true == true + +false == false +false == false +true == true +true == true +true == true +true == true + + +Lower 'c'-words: +- coverage +- considered + +Any 'c'-words: +- Code +- coverage +- considered + +Lower line-last words: +- coverage + +Any line-last words: +- coverage +- BROKEN + +Any last words: +- BROKEN + +c-word with follower: +- "Code without" + Groups: "Code without", "Code", "without" +- "coverage\nis" + Groups: "coverage\nis", "coverage", "is" +- "considered to" + Groups: "considered to", "considered", "to" + +c-word with follower in the same line: +- Code without +- considered to + +Lower c-word with follower in the same line: +- considered to + + Ignored but logged in 2.3: False == False + Ignored but logged in 2.3: False == False + +FOObar == FOObar +Foobar == Foobar +FOObar == FOObar +FOObarFOO == FOObarFOO +FOObarfOO == FOObarfOO +FOObarfOO == FOObarfOO +Foobar == Foobar +FOObar == FOObar +FOObarFOO == FOObarFOO +FOObarfOO == FOObarfOO +FOObarfOO == FOObarfOO +foobar == foobar +foobar == foobar +FOObar == FOObar +FOObarFOO == FOObarFOO +FOObarfOo == FOObarfOo +FAlse == FAlse +FAlse == FAlse + + Ignored but logged in 2.3: FOObar + +[foo, barxbaaz] == [foo, barxbaaz] +[foo, barxbaaz] == [foo, barxbaaz] +[foo, bar, baaz] == [foo, bar, baaz] +[foo, barxbaaz] == [foo, barxbaaz] +[foo, bar, baaz] == [foo, bar, baaz] +[fooXXbarxxbaaz] == [fooXXbarxxbaaz] +[foo, bar, baaz] == [foo, bar, baaz] +[F, ls] == [F, ls] +[Fals, ] == [Fals, ] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins1.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins1.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins1.txt new file mode 100644 index 0000000..6e689ac --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins1.txt @@ -0,0 +1,112 @@ +/* + * 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. + */ +FreeMarker: Encoding string built-in tests + + +cap_first: DieBugsDie! * vazzZE 123456 --cdc-- --<<--@ x ${"kigyo"?upper_case} +uncap_first: dieBugsDie! * vazzZE 123456 --cdc-- --<<--@ x ${"kigyo"?upper_case} +uncap_first:blah +capitalize: Diebugsdie! * Vazzze 123456 --cdc-- --<<--@ X ${"kigyo"?upper_case} +html: dieBugsDie! * vazzZE 123456 --cdc-- --<<--@ x ${"kigyo"?upper_case} +length: 71 +lower_case: diebugsdie! * vazzze 123456 --cdc-- --<<--@ x ${"kigyo"?upper_case} +rtf: dieBugsDie! * vazzZE 123456 --cdc-- --<<--@ x $\{"kigyo"?upper_case\} +trim: dieBugsDie! * vazzZE 123456 --cdc-- --<<--@ x ${"kigyo"?upper_case} +trim2: foo bar +trim3: foo bar +trim4: foo bar +upper_case: DIEBUGSDIE! * VAZZZE 123456 --CDC-- --<<--@ X ${"KIGYO"?UPPER_CASE} +xml: dieBugsDie! * vazzZE 123456 --cdc-- --<<--@ x ${"kigyo"?upper_case} +xhtml: "Blah's is > 1 & < 2" + +word_list: +- dieBugsDie! +- * +- vazzZE +- 123456 +- --cdc-- +- --<<--@ +- x +- ${"kigyo"?upper_case} + +interpret: dieBugsDie! * vazzZE 123456 --cdc-- --<<--@ x KIGYO +number: -122,35 +1500 +5 +0 +0 +true +true +true +true +true + +default constructor +1 +xxx +xxx:yyy + + +In The Sacred, Holy beginning, God created The Sacred, Holy Heavens and The Sacred, Holy Earth. +In the very beginning, God created the Heavens and The Earth. +|I|n| |t|h|e| |b|e|g|i|n|n|i|n|g|,| |G|o|d| |c|r|e|a|t|e|d| |t|h|e| |H|e|a|v|e|n|s| |a|n|d| |T|h|e| |E|a|r|t|h|.| +|In the beginning, God created the Heavens and The Earth. + +In the beginning, God created the sky and The Earth. + +matches + + the beginning + the sacred beginning + the Heavens + the sacred Heavens + The Earth + The sacred Earth + +In the beginning, God created the Heavens and The Earth. +beginning +the Heavens and The Earth. + + foo + bar + baz + foobar + + +FOOBAR + +[a] = [a] +[a\\'x'\nb] = [a\\'x'\nb] +[\u0001\u001a ] = [\u0001\u001a ] + +[a] = [a] +[a\\\'x\'\nb] = [a\\\'x\'\nb] +[\x01\x1A ] = [\x01\x1A ] +[\x3C![CDATA[] = [\x3C![CDATA[] +[]]\>] = []]\>] + +[a] = [a] +[a\\'x'\nb] = [a\\'x'\nb] +[\u0001\u001A ] = [\u0001\u001A ] +[\n\r\t\f\b\"] = [\n\r\t\f\b\"] +[\/] = [\/] +[a/b] = [a/b] +[<\/script>] = [<\/script>] +[\u003C![CDATA[] = [\u003C![CDATA[] +[]]\u003E] = []]\u003E] http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins2.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins2.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins2.txt new file mode 100644 index 0000000..f5eebd9 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/string-builtins2.txt @@ -0,0 +1,135 @@ +/* + * 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. + */ +-- +1 = 1 +5 = 5 +0 = 0 +-- +5 = 5 +1 = 1 +7 = 7 +-- +true = true +false = false +true = true +-- +true = true +false = false +true = true +-- +true = true +true = true +true = true +false = false +true = true +-- +[abbcdbb] = [abbcdbb] +[qwe] = [qwe] +[qwe] = [qwe] +[qwe] = [qwe] +[qwe +] = [qwe +] +[qwe +] = [qwe +] +-- +[abbcdbb] = [abbcdbb] +[abb-dbb] = [abb-dbb] +[a-=*cd-=*] = [a-=*cd-=*] +-- +[a][][cd][][] == [a][][cd][][] +[][die][maggots][!] == [][die][maggots][!] +[Die maggots!] == [Die maggots!] +-- +[ ] +[ a] +[ ab] +[ abc] +[ abcd] +[abcde] +[abcdef] +[abcdefg] +[abcdefgh] +[-----] +[----a] +[---ab] +[--abc] +[-abcd] +[abcde] +[abcdef] +[abcdefg] +[abcdefgh] +[.oO.oO.o] +[.oO.oO.a] +[.oO.oOab] +[.oO.oabc] +[.oO.abcd] +[.oOabcde] +[.oabcdef] +[.abcdefg] +[abcdefgh] +[abcdefghi] +[abcdefghij] +[] +[/] +[/\] +[/\_] +[/\_/] +[/\_/\] +[/\_/\_] +[/\_/\_/] +-- +[ ] +[a ] +[ab ] +[abc ] +[abcd ] +[abcde] +[abcdef] +[abcdefg] +[abcdefgh] +[-----] +[a----] +[ab---] +[abc--] +[abcd-] +[abcde] +[abcdef] +[abcdefg] +[abcdefgh] +[.oO.oO.o] +[aoO.oO.o] +[abO.oO.o] +[abc.oO.o] +[abcdoO.o] +[abcdeO.o] +[abcdef.o] +[abcdefgo] +[abcdefgh] +[abcdefghi] +[abcdefghij] +[] +[/] +[/\] +[/\_] +[/\_/] +[/\_/\] +[/\_/\_] +[/\_/\_/] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/stringbimethods.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/stringbimethods.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/stringbimethods.txt new file mode 100644 index 0000000..8ef415d --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/stringbimethods.txt @@ -0,0 +1,29 @@ +/* + * 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. + */ +3.00 +3.00 +01:02:03.000 +01:02:03.000 +--- +de +true false +yes no +igen nem +0.0 1.0 +true true \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/stringliteral.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/stringliteral.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/stringliteral.txt new file mode 100644 index 0000000..3d9d4c9 Binary files /dev/null and b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/stringliteral.txt differ http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/switch.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/switch.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/switch.txt new file mode 100644 index 0000000..5d42785 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/switch.txt @@ -0,0 +1,80 @@ +/* + * 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. + */ + + +Here we iterate over a list of animals.
+ +Animal is: aardvark.
+ This is the HTML for other animals.
+
Animal is: kiwi.
+ This is the HTML for the user's favorite animal.
+
Animal is: gecko.
+ This is the HTML for small animals.
+
Animal is: cat.
+ This is the HTML for other animals.
+
Animal is: dog.
+ This is the HTML for other animals.
+
Animal is: elephant.
+ This is the HTML for large animals.
+
Animal is: squirrel.
+ This is the HTML for small animals.
+
Animal is: zebra.
+ This is the HTML for a large stripey animal.
+ This is the HTML for large animals.
+
A simple test follows:
+ +Hello, world!
+ +<p>Hello, world!</p> + +Now try the Utility package:
+Utility transformations
+ +<p>Utility transformations</p> + +Now some nested transforms:
+This tests the compress transformation
<p >This tests the compress transformation</p ><p >This tests the compress transformation</p > +Now try method and transform interactions:
+<p>This isn't a valid XML string.</p> +<p>This isn't a valid HTML string.</p> + +A more advanced interaction involves getting a TemplateMethodModel +to initialise a TemplateTransformModel, as follow:
+ +Comment: This is a comment + +A test string containing quotes: "This isn't a test". +A test string containing amps: Fish & Chips. +A test string containing tags:Fish & Chips.
+ +Comment: This is a second comment + +A test string containing quotes: "This isn't a test". +A test string containing amps: Fish & Chips. +A test string containing tags:Fish & Chips.
+Comment: This is a third comment + +A test string containing quotes: "This isn't a test". +A test string containing amps: Fish & Chips. +A test string containing tags:Fish & Chips.
+Comment: Utility transformations + +A test string containing quotes: "This isn't a test". +A test string containing amps: Fish & Chips. +A test string containing tags: <p>Fish & Chips.</p> + + + http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/type-builtins.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/type-builtins.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/type-builtins.txt new file mode 100644 index 0000000..0b4e23a --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/type-builtins.txt @@ -0,0 +1,33 @@ +/* + * 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. + */ +StNuBoMeTaMaHaHxSeCoCxEnInDiNo +1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 +0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 +0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 +0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 +0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 +1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 +0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/var-layers.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/var-layers.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/var-layers.txt new file mode 100644 index 0000000..5fd6e2e --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/var-layers.txt @@ -0,0 +1,37 @@ +/* + * 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. + */ + 1 = 1 + 2 = 2 + 3 = 3 +4 = 4 = 4 +5 = 5 = 5 +6 but 4 = 4 +7 = 7 = 7 +Invisiblity test 1.: passed +Invisiblity test 2.: passed +Invisiblity test 3.: passed +-- + 1 = 1 + 2 = 2 + 3 = 3 + 4 = 4 = 4 = 4 + 5 + 6 == 6 + 7 == 7 == 7 +-- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/varargs.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/varargs.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/varargs.txt new file mode 100644 index 0000000..a310855 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/varargs.txt @@ -0,0 +1,44 @@ +/* + * 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. + */ + +0 == 0 +0 == 0 +11 == 11 +11 == 11 +1122 == 1122 +1122 == 1122 +112233 == 112233 +112233 == 112233 + +-22334411 == -22334411 +-223311 == -223311 +-2211 == -2211 +-11 == -11 + +0 == 0 +-11 == -11 +1122 == 1122 +-112233 == -112233 +-11223344 == -11223344 +-1122334455 == -1122334455 + +1122 == 1122 +-1122 == -1122 + +string, true, 123, 1000000 == string, true, 123, 1000000 http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/variables.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/variables.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/variables.txt new file mode 100644 index 0000000..5365b07 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/variables.txt @@ -0,0 +1,62 @@ +/* + * 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. + */ + + +A simple test follows:
+ +Hello, world!
+ +Now get into variable nesting:
+ +My message.
+My message.
+My message.
+My message.
+My message.
+My message.
+My message.
+My message.
+ +More deep nesting...
+ +My message.
+one
+one
+ + +Nesting inside nesting...
+ +two
+two
+two
+two
+ +Test underscores...
+ +out
+out
+ +SAVE + + + http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/whitespace-trim.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/whitespace-trim.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/whitespace-trim.txt new file mode 100644 index 0000000..e74163a --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/whitespace-trim.txt @@ -0,0 +1,60 @@ +/* + * 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. + */ +LB +LB +LB +LB + IB + IC1 IC2C1C2 ICS CS1 CS2 C3C1C2 +B +B +C1CB +C1 +C2 ICB + IC ICB + ICCB +-- +LB +LB +LB +LB + IB + IC1 IC2C1C2 ICS CS1 CS2 C3C1C2 +B +B +C1CB +C1 +C2 ICB + IC ICB + ICCB +-- + IB + IC1C2 IB +12 +--- +1 23 + 4 + 5 6 +--- +a +bc +--- +foo +--- +foo http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/wstrip-in-header.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/wstrip-in-header.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/wstrip-in-header.txt new file mode 100644 index 0000000..2cb2913 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/wstrip-in-header.txt @@ -0,0 +1,23 @@ +/* + * 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. + */ +a + +b +a +b \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/wstripping.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/wstripping.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/wstripping.txt new file mode 100644 index 0000000..2aae297 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/wstripping.txt @@ -0,0 +1,39 @@ +/* + * 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. + */ +a +b +c +d +e2 +f +g +x + x + x + y +y +x +y +x +y +a + x +b + x +c \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/28a276c8/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/xml-fragment.txt ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/xml-fragment.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/xml-fragment.txt new file mode 100644 index 0000000..cb0da5f --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/test/templatesuite/expected/xml-fragment.txt @@ -0,0 +1,25 @@ +/* + * 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. + */ +b = b +@document = @document +@document = @document + +C<>&"']]> = C<>&"']]> + +