Skip to content

Instantly share code, notes, and snippets.

@rbk
Created December 11, 2013 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbk/7904958 to your computer and use it in GitHub Desktop.
Save rbk/7904958 to your computer and use it in GitHub Desktop.
require_relative 'class_tut_file'
require 'test/unit'
class TestTut < Test::Unit::TestCase
def setup
@tut = "I'mut inut tututut bututut I wutanuttut tuto bute inut enutgutlutisuthut."
@english = "I'm in tut but I want to be in english."
end
def test_is_tut
assert_equal true, Tut.is_tut?( @tut )
assert_equal false, Tut.is_tut?( @english )
assert_equal false, Tut.is_tut?( "" )
end
def test_to_tut_without_block
assert_equal @tut, Tut.to_tut( @english )
assert_equal nil, Tut.to_tut( @tut )
assert_equal "", Tut.to_tut( "" )
assert_equal @tut, Tut.to_tut( @tut ){ |c| c }
end
def test_to_tut_with_block
assert_equal @tut, Tut.to_tut( @tut ) { |c| c }
end
# def test_to_english_without_block
# assert_equal @english, Tut.to_english( @tut )
# end
# def test_to_english_with_block
# end
end
#Tut.to_tut( "Wow! Look at this get converted to Tut!" ) { |c| puts c }
## should outout : Wutowut! Lutookut atut tuthutisut gutetut cutonutvuteruttutedut tuto Tututut!
#tut_string = ""
#Tut.to_tut( "I'm in tut but I want to be in english." ) { |c| tut_string += c }
#puts tut_string
## should output : I'mut inut tututut bututut I wutanuttut tuto bute inut enutgutlutisuthut.
#Tut.to_english( tut_string ) { |c| print c }
## should output : I'm in tut but I want to be in english.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment