#!/usr/bin/env ruby -w # encoding: UTF-8 # # = test_format_TextFormatter.rb -- The TaskJuggler III Project Management Software # # Copyright (c) 2006, 2007, 2008, 2009, 2010 by Chris Schlaeger # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if __FILE__ == $0 require 'test/unit' require 'TextFormatter' class TestTextFormatter < Test::Unit::TestCase def setup end def teardown end def test_format_empty ftr = TaskJuggler::TextFormatter.new(20, 2, 4) inp = '' ref = "\n" out = ftr.format(inp) assert_equal(ref, out) end def test_format_singleWord ftr = TaskJuggler::TextFormatter.new(20, 2, 4) inp = 'foo' ref = " foo\n" out = ftr.format(inp) assert_equal(ref, out) end def test_format_multipleWords ftr = TaskJuggler::TextFormatter.new(20, 2, 4) inp = "foo bar \n foobar" ref = " foo bar foobar\n" out = ftr.format(inp) assert_equal(ref, out) end def test_format_multipleLines ftr = TaskJuggler::TextFormatter.new(23, 2, 4) inp = <