| 
					
					
					
				 | 
				@ -1,7 +1,8 @@ | 
			
		
		
	
		
			
				 | 
				 | 
				require_relative '../../lib/formatters/wrapper' | 
				 | 
				 | 
				require_relative '../../lib/formatters/wrapper' | 
			
		
		
	
		
			
				 | 
				 | 
				require 'test/unit' | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				class TestWrapper < Test::Unit::TestCase | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				require 'minitest/autorun' | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				class Wrapper2Test < Minitest::Test | 
			
		
		
	
		
			
				 | 
				 | 
				  def test_wrap_score | 
				 | 
				 | 
				  def test_wrap_score | 
			
		
		
	
		
			
				 | 
				 | 
				    assert_wrap("\ | 
				 | 
				 | 
				    assert_wrap("\ | 
			
		
		
	
		
			
				 | 
				 | 
				********************\n\ | 
				 | 
				 | 
				********************\n\ | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -28,18 +29,30 @@ IMIT\", 1]]", "\ | 
			
		
		
	
		
			
				 | 
				 | 
				                20) | 
				 | 
				 | 
				                20) | 
			
		
		
	
		
			
				 | 
				 | 
				  end | 
				 | 
				 | 
				  end | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  def test_carriage_return | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    assert_wrap('text', "text\n\n", 10) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    assert_wrap('first   ', "first   \n", 10) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    assert_wrap('first    ', "first    \n", 10) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    assert_wrap('first     ', "first     \n", 10) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    assert_wrap("first     \n  second  ", "first\n  second\n", 10) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    assert_wrap("\e[0;35mhello\e[0m   \n\e[0;35m\e[0m\n\e[0;35myop", "\e[0;35mhello\n\nyop", 10) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  end | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				  private | 
				 | 
				 | 
				  private | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				  def assert_wrap(expectation, text, length, prefix = '') | 
				 | 
				 | 
				  def assert_wrap(expectation, text, length, prefix = '') | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    show_with_style(text, length, prefix) | 
			
		
		
	
		
			
				 | 
				 | 
				    assert_equal(expectation, prefix + Wrapper.wrap(text, prefix, length - prefix.length)) | 
				 | 
				 | 
				    assert_equal(expectation, prefix + Wrapper.wrap(text, prefix, length - prefix.length)) | 
			
		
		
	
		
			
				 | 
				 | 
				    test_with_style(text, length, prefix) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				  end | 
				 | 
				 | 
				  end | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				  def test_with_style(text, length, prefix = '') | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				    begint = "my text is:\n" | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				    endoft = "a final is:\n" | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				    puts "#{begint}#{prefix}#{text}\e[0m" | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				    puts "#{endoft}#{prefix}#{Wrapper.wrap(text, prefix, length - prefix.length)}\e[0m" | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  def show_with_style(text, length, prefix = '') | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    expectation = Wrapper.wrap(text, prefix, length - prefix.length) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    puts "original_o is:\n#{prefix}[#{text}]\e[0m" | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    puts "original_i is:\n#{prefix}[#{text.inspect}]\e[0m" | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    puts | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    puts "final_o is:\n#{prefix}[#{expectation}]\e[0m" | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    puts "final_i is:\n#{prefix}[#{expectation.inspect}]\e[0m" | 
			
		
		
	
		
			
				 | 
				 | 
				    puts | 
				 | 
				 | 
				    puts | 
			
		
		
	
		
			
				 | 
				 | 
				  end | 
				 | 
				 | 
				  end | 
			
		
		
	
		
			
				 | 
				 | 
				end | 
				 | 
				 | 
				end |