Sha256: 7b10229b379674f712812db92155e1a46ea933f7da0fe42d06deb4d97062b1e5
Contents?: true
Size: 1.5 KB
Versions: 228
Compression:
Stored size: 1.5 KB
Contents
$:.unshift File.join(File.dirname(__FILE__),"..","lib") require 'test/unit' require 'rgen/template_language/output_handler' class MetamodelBuilderTest < Test::Unit::TestCase def test_direct_nl h = RGen::TemplateLanguage::OutputHandler.new h.mode = :direct h << "Test" h.ignoreNextNL h << "\nContent" assert_equal "TestContent", h.to_s end def test_direct_ws h = RGen::TemplateLanguage::OutputHandler.new h.mode = :direct h << "Test" h.ignoreNextWS h << " \n Content" assert_equal "TestContent", h.to_s end def test_explicit_indent h = RGen::TemplateLanguage::OutputHandler.new h.mode = :explicit h.indent = 1 h << "Start" h << " \n " h << "Test" h << " \n \n Content" assert_equal " Start\n Test\n Content", h.to_s end def test_explicit_endswithws h = RGen::TemplateLanguage::OutputHandler.new h.mode = :explicit h.indent = 1 h << "Start \n\n" assert_equal " Start\n", h.to_s end def test_performance h = RGen::TemplateLanguage::OutputHandler.new h.mode = :explicit h.indent = 1 line = (1..50).collect{|w| "someword"}.join(" ")+"\n" # repeat more often to make performance differences visible 20.times do h << line end end def test_indent_string h = RGen::TemplateLanguage::OutputHandler.new(1, "\t", :explicit) h << "Start" h << " \n " h << "Test" h << " \n \n Content" assert_equal "\tStart\n\tTest\n\tContent", h.to_s end end
Version data entries
228 entries across 228 versions & 3 rubygems