class TestEmodePreProcessor

Public Instance Methods

ok(e, str) click to toggle source
# File vendor/qwik/lib/qwik/parser-emode.rb, line 81
def ok(e, str)
  str = "============================================================\n"+str
  ok_eq(e, Qwik::EmodePreProcessor.preprocess(str))
end
test_all() click to toggle source
# File vendor/qwik/lib/qwik/parser-emode.rb, line 86
def test_all
  c = Qwik::EmodePreProcessor

  # test_emode?
  eq(false, !!c.emode?(''))
  eq(true,  !!c.emode?("============================================================"))

  # test_preprocess
  ok('*t', "●t")
  ok("*1\n-t", "・t")
  ok("*1\nt{{br}}", 't')
  ok("*t\nt1{{br}}\nt2{{br}}", "●t\nt1\nt2")
  ok("*t\nt1{{br}}\n====\nt2{{br}}",
     "●t\nt1\n------------------------------------------------------------\nt2")
  #ok("*t\n>t1{{br}}\n>t2{{br}}", "●t\n>t1\n>t2") # impossible...
  ok("*t\n>t1\n>t2", "●t\n>t1\n>t2")
  ok("*1\n-", '-')
  ok('*1',
     '------------------------------------------------------------')

  # test_sjis_bug
  ok("*1\nー{{br}}\nt{{br}}", "ー\nt")

  # test_br
  ok("*1\n{{{\nt{{br}}\n}}}", "{{{\nt\n}}}")

  # test_multiline
  ok("*1\na{{br}}\n\nb{{br}}", "a\n\nb")
end