class TEST_FORMATTER -- Test harness for the output formatter. -- Author: Ian Barnes -- $Revision: 2004.2 $ -- $Date: 2004/03/12 00:53:44 $ creation make feature make is -- Test the formatter by reading from standard input, -- which is assumed to have exactly one word or command -- per line. local formatter: OUTPUT_FORMATTER word: STRING do create formatter.make (std_output) -- Read words and instructions, one per line. from std_input.read_line until std_input.end_of_input loop word := clone (std_input.last_string) word.left_adjust word.right_adjust if word.same_as ("@justify") then formatter.set_justify elseif word.same_as ("@right") then formatter.set_right_align elseif word.same_as ("@centre") then formatter.set_centre_align elseif word.same_as ("@left") then formatter.set_left_align elseif word.has_prefix ("@width=") then word.remove_prefix ("@width=") formatter.set_width (word.to_integer) elseif word.same_as ("@indent") then formatter.indent elseif word.same_as ("@outdent") then formatter.outdent elseif word.same_as ("@blank") then formatter.blank_line else formatter.add_word (word) end std_input.read_line end formatter.blank_line end end -- class TEST_FORMATTER