# test_formatting.rb # 10. April 2007 # #circumventing a require Problem: $:.unshift File.join(File.dirname(__FILE__), "..", "lib") begin require "rubygems" require "clothred" rescue LoadError require "clothred" end require "test/unit" class TestClothRedFormatting < Test::Unit::TestCase FORMATTING_STRINGS = [ ["bold","**bold**"], ["strong", "*strong*"], ["emphasized", "_emphasized_"],["italics", "__italics__"], ["citation", "??citation??"], ["ClothRed#to_textile", "@ClothRed#to_textile@"], ["delete", "-delete-"], ["underline", "+underline+"], ["superscript","^superscript^"], ["subscript","~subscript~"] ] def test_textformatting FORMATTING_STRINGS.each do |html, textile| test_html = ClothRed.new(html) result = test_html.to_textile assert_equal(textile,result.to_s) end end end