PageRenderTime 27ms CodeModel.GetById 19ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/test/lib/string/test_argument_filling.e

http://github.com/tybor/Liberty
Specman e | 34 lines | 26 code | 4 blank | 4 comment | 0 complexity | 74ebe64a790a4a57a4b8e9ee390b0e3d MD5 | raw file
 1-- This file is part of SmartEiffel The GNU Eiffel Compiler Tools and Libraries.
 2-- See the Copyright notice at the end of this file.
 3--
 4class TEST_ARGUMENT_FILLING
 5   -- Test `arg' infix "#" operators in ABSTRACT_STRING, actually also testing FILLABLE_STRING.
 6
 7insert
 8   EIFFELTEST_TOOLS
 9
10create {}
11   make
12
13feature {ANY}
14   make
15      do
16         assert(("# is not changed").arg(1, "dummy").is_equal("# is not changed"))
17         assert(("And also #(12345 is not changed").arg(1, "dummy").is_equal("And also #(12345 is not changed"))
18         assert(("#(1) is nice").arg(1, "Eiffel").is_equal("Eiffel is nice"))
19         assert(("But #(1) and #(2) are").arg(1, "one").arg(2, "another").is_equal("But one and another are"))
20         assert(("But #(1) and #(2) are").arg(2, "another").arg(1, "one").is_equal("But one and another are"))
21         assert(("But #(1) and #(2) are").arg(1, "one").arg(2, "another").is_equal("But one and another are"))
22         assert(("Hey #(2) I got #(1) with #(3)!").arg(1, "an apple").arg(2, "teacher").arg(3, "a worm").is_equal("Hey teacher I got an apple with a worm!"))
23         assert(("#(1) is #(1)").arg(1, "life").is_equal("life is life"))
24         assert(("He sang «#(1) is #(1)»").arg(1, "life").is_equal("He sang «life is life»"))
25         assert(("Also ## is not changed" # "dummy").is_equal("Also # is not changed")) -- ## is used to escape #
26         assert(("Even #( is not changed" # "dummy").is_equal("Even #( is not changed"))
27         assert(("#(1) is nice" # "Eiffel").is_equal("Eiffel is nice"))
28         assert(("But #(1) and #(2) are" # "one" # "another").is_equal("But one and another are"))
29         assert(("Hey #(2) I got #(1) with #(3)!" # "an apple" # "teacher" # "a worm").is_equal("Hey teacher I got an apple with a worm!"))
30         assert(("#(1) is #(1)" # "life").is_equal("life is life"))
31         assert(("He sang «#(1) is #(1)»" # "life").is_equal("He sang «life is life»"))
32      end
33
34end -- class TEST_ARGUMENT_FILLING