class TestPageClassMethod

Public Instance Methods

ok_get_title(e, s) click to toggle source
# File vendor/qwik/lib/qwik/page-get.rb, line 192
def ok_get_title(e, s)
  res = Qwik::Page.get_title(s)
  ok_eq(e, res)
end
ok_title(e, s) click to toggle source
# File vendor/qwik/lib/qwik/page-get.rb, line 187
def ok_title(e, s)
  title, tags = Qwik::Page.get_title(s)
  ok_eq(e, title)
end
test_get_body() click to toggle source
# File vendor/qwik/lib/qwik/page-get.rb, line 245
    def test_get_body
      c = Qwik::Page
      ok_eq('b',        c.get_body("* t\nb"))
      ok_eq('b',        c.get_body("* t\n\nb"))
#      ok_eq('b',       c.get_body("# c\n* t\nb"))
      ok_eq("b1\nb2",   c.get_body("b1\nb2"))
      ok_eq("** t\nb",  c.get_body("** t\nb"))
      ok_eq('* t2',     c.get_body("* t\n* t2"))
      ok_eq('* t2',     c.get_body("* t\n\n* t2"))
    end
test_get_body_sharp() click to toggle source
# File vendor/qwik/lib/qwik/page-get.rb, line 256
def test_get_body_sharp
  c = Qwik::Page
  ok_eq("a\n#b\nc", c.get_body("a\n#b\nc"))
end
test_get_first_line() click to toggle source
# File vendor/qwik/lib/qwik/page-get.rb, line 235
def test_get_first_line
  c = Qwik::Page
  ok_eq('',         c.get_first_line(''))
  ok_eq('',         c.get_first_line("\n"))
  ok_eq('line1',    c.get_first_line('line1'))
  ok_eq('l1',       c.get_first_line("l1\nl2\n"))
  ok_eq('',         c.get_first_line("\nline2\n"))
  ok_eq('l1',       c.get_first_line("# c\nl1\nl2\n"))
end
test_get_title() click to toggle source
# File vendor/qwik/lib/qwik/page-get.rb, line 197
def test_get_title
  c = Qwik::Page

  ok_title(nil, nil)
  ok_title(nil, '')
  ok_title(nil, 't')        # must begin with *
  ok_title(nil, '-t')
  ok_title(nil, "b1\nb2")
  ok_title(nil, '** t')     # must be h2 level header.
  ok_title(nil, '**t')
  ok_title(nil, "** t\nb")
  ok_title(nil, '*')        # empty
  ok_title(nil, '* ')
  ok_title(nil, '*  ')

  ok_title('t', '*t')       # normal
  ok_title('t', '* t')
  ok_title('t', '*t ')
  ok_title('t', '* t ')
  ok_title('a b', '*a b')
  ok_title('a b', '* a b')
  ok_title('*t', '* *t')    # uum...
  ok_title('- t', '*- t')   # uum...
  ok_title('t', "* t\nb")
  ok_title('t', "# c\n* t\nb")
  ok_title('字', '*字')
  ok_title('あ', '*あ')
  ok_title('コ', '* コ')
  ok_title('コ', "* コ\n{{mail(user@e.com)\nあ\n\n}}\n")

  # The title line can contain tag data.
  ok_get_title(['t', ['tag']],      '* [tag] t')
  ok_get_title(['t', ['t1', 't2']], '* [t1][t2] t')
  ok_get_title(['[tag]', []],       '* [tag]')
  ok_get_title(['[t2]', ['t1']],    '* [t1][t2]')
  ok_get_title(['t', ['2001-02-03']],       '* [2001-02-03] t')
end
test_valid_as_pagekey?() click to toggle source
# File vendor/qwik/lib/qwik/page-get.rb, line 181
def test_valid_as_pagekey?
  c = Qwik::Page
  ok_eq(true,  !!c.valid_as_pagekey?('t'))
  ok_eq(false, !!c.valid_as_pagekey?('t t'))
end