Class: MarkdownExec::TestMDoc
- Defined in:
- lib/mdoc.rb
Instance Method Summary collapse
- #setup ⇒ Object
- #test_collect_block_dependencies ⇒ Object
- #test_fcbs_per_options ⇒ Object
- #test_get_block_by_name ⇒ Object
-
#test_hide_menu_block_on_name ⇒ Object
broken test.
-
#test_recursively_required ⇒ Object
broken test.
Instance Method Details
#setup ⇒ Object
679 680 681 682 683 684 685 686 687 688 |
# File 'lib/mdoc.rb', line 679 def setup @table = [ { oname: 'block1', body: ['code for block1'], reqs: ['block2'] }, { oname: 'block2', body: ['code for block2'], reqs: nil }, { oname: 'block3', body: ['code for block3'], reqs: ['block1'] } ].map do |row| FCB.new(nickname: nil, **row) end @doc = MDoc.new(@table) end |
#test_collect_block_dependencies ⇒ Object
698 699 700 701 702 703 704 705 706 |
# File 'lib/mdoc.rb', line 698 def test_collect_block_dependencies result = @doc.collect_block_dependencies(anyname: 'block3')[:blocks] expected_result = [@table[0], @table[1], @table[2]] assert_equal expected_result, result assert_raises(RuntimeError) do @doc.collect_block_dependencies(anyname: 'missing_block') end end |
#test_fcbs_per_options ⇒ Object
716 717 718 719 720 721 |
# File 'lib/mdoc.rb', line 716 def opts = { hide_blocks_by_name: true, block_name_hide_custom_match: 'block1' } result = @doc.(opts) assert_equal [@table[1], @table[2]], result end |
#test_get_block_by_name ⇒ Object
690 691 692 693 694 695 696 |
# File 'lib/mdoc.rb', line 690 def test_get_block_by_name result = @doc.get_block_by_anyname('block1') assert_equal @table[0], result result_missing = @doc.get_block_by_anyname('missing_block') assert_equal({}, result_missing) end |
#test_hide_menu_block_on_name ⇒ Object
broken test
708 709 710 711 712 713 714 |
# File 'lib/mdoc.rb', line 708 def opts = { hide_blocks_by_name: true, block_name_hide_custom_match: 'block1' } block = FCB.new(s2title: 'block1') result = @doc.(opts, block) assert result # this should be true based on the given logic end |
#test_recursively_required ⇒ Object
broken test
723 724 725 726 727 728 729 730 731 732 |
# File 'lib/mdoc.rb', line 723 def test_recursively_required result = @doc.recursively_required_hash('block3') assert_equal ({ 'block3' => ['block1'], 'block1' => ['block2'], 'block2' => [nil] }), result result_no_reqs = @doc.recursively_required_hash(nil) assert_equal ({}), result_no_reqs end |