/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. --
  4. class TEST_ARGUMENT_FILLING
  5. -- Test `arg' infix "#" operators in ABSTRACT_STRING, actually also testing FILLABLE_STRING.
  6. insert
  7. EIFFELTEST_TOOLS
  8. create {}
  9. make
  10. feature {ANY}
  11. make
  12. do
  13. assert(("# is not changed").arg(1, "dummy").is_equal("# is not changed"))
  14. assert(("And also #(12345 is not changed").arg(1, "dummy").is_equal("And also #(12345 is not changed"))
  15. assert(("#(1) is nice").arg(1, "Eiffel").is_equal("Eiffel is nice"))
  16. assert(("But #(1) and #(2) are").arg(1, "one").arg(2, "another").is_equal("But one and another are"))
  17. assert(("But #(1) and #(2) are").arg(2, "another").arg(1, "one").is_equal("But one and another are"))
  18. assert(("But #(1) and #(2) are").arg(1, "one").arg(2, "another").is_equal("But one and another are"))
  19. 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!"))
  20. assert(("#(1) is #(1)").arg(1, "life").is_equal("life is life"))
  21. assert(("He sang «#(1) is #(1)»").arg(1, "life").is_equal("He sang «life is life»"))
  22. assert(("Also ## is not changed" # "dummy").is_equal("Also # is not changed")) -- ## is used to escape #
  23. assert(("Even #( is not changed" # "dummy").is_equal("Even #( is not changed"))
  24. assert(("#(1) is nice" # "Eiffel").is_equal("Eiffel is nice"))
  25. assert(("But #(1) and #(2) are" # "one" # "another").is_equal("But one and another are"))
  26. assert(("Hey #(2) I got #(1) with #(3)!" # "an apple" # "teacher" # "a worm").is_equal("Hey teacher I got an apple with a worm!"))
  27. assert(("#(1) is #(1)" # "life").is_equal("life is life"))
  28. assert(("He sang «#(1) is #(1)»" # "life").is_equal("He sang «life is life»"))
  29. end
  30. end -- class TEST_ARGUMENT_FILLING