File: test_rdoc_rd_inline.rb

package info (click to toggle)
ruby3.1 3.1.2-7%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 132,892 kB
  • sloc: ruby: 1,154,753; ansic: 736,782; yacc: 46,445; pascal: 10,401; sh: 3,931; cpp: 1,158; python: 838; makefile: 787; asm: 462; javascript: 382; lisp: 97; sed: 94; perl: 62; awk: 36; xml: 4
file content (64 lines) | stat: -rw-r--r-- 1,380 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# frozen_string_literal: true
require_relative 'helper'

class TestRDocRdInline < RDoc::TestCase

  def setup
    super

    @inline = RDoc::RD::Inline.new '+text+', 'text'
  end

  def test_class_new
    inline = RDoc::RD::Inline.new @inline

    refute_equal inline.rdoc, inline.reference
  end

  def test_initialize
    inline = RDoc::RD::Inline.new 'text'

    assert_equal inline.rdoc, inline.reference
    refute_same  inline.rdoc, inline.reference
  end

  def test_initialize_inline
    inline = RDoc::RD::Inline.new @inline

    assert_equal '+text+', inline.rdoc
    assert_equal 'text',   inline.reference
  end

  def test_append_inline
    out = @inline.append @inline

    assert_same @inline, out

    assert_equal '+text++text+', @inline.rdoc
    assert_equal 'texttext',     @inline.reference
  end

  def test_append_string
    @inline.append ' more'

    assert_equal '+text+ more', @inline.rdoc
    assert_equal 'text more',   @inline.reference
  end

  def test_equals2
    assert_equal @inline, RDoc::RD::Inline.new('+text+', 'text')
    refute_equal @inline, RDoc::RD::Inline.new('+text+', 'other')
    refute_equal @inline, RDoc::RD::Inline.new('+other+', 'text')
    refute_equal @inline, Object.new
  end

  def test_inspect
    assert_equal '(inline: +text+)', @inline.inspect
  end

  def test_to_s
    assert_equal '+text+', @inline.to_s
  end

end