Skip to content

Commit

Permalink
Fix method scope in test in order to invoke the tests properly
Browse files Browse the repository at this point in the history
The `test_empty` and `test_linear_performance_gt` were defined as private method.
Seems that test-unit runner does not invoke private methods even if the methods have `test_` prefix.
  • Loading branch information
Watson1978 committed Jul 19, 2024
1 parent 7e75de2 commit f946711
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions test/parse/test_entity_declaration.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# frozen_string_literal: false
require 'test/unit'
require 'rexml/document'
require "test/unit"
require "core_assertions"

require "rexml/document"

module REXMLTests
class TestParseEntityDeclaration < Test::Unit::TestCase
include Test::Unit::CoreAssertions

private
def xml(internal_subset)
<<-XML
Expand All @@ -18,25 +22,22 @@ def parse(internal_subset)
REXML::Document.new(xml(internal_subset)).doctype
end

public
def test_empty
exception = assert_raise(REXML::ParseException) do
assert_raise(REXML::ParseException) do
parse(<<-INTERNAL_SUBSET)
<!ENTITY>
INTERNAL_SUBSET
end
assert_equal(<<-DETAIL.chomp, exception.to_s)
Malformed notation declaration: name is missing
Line: 5
Position: 72
Last 80 unconsumed characters:
<!ENTITY> ]> <r/>
DETAIL
end

def test_linear_performance_gt
seq = [10000, 50000, 100000, 150000, 200000]
assert_linear_performance(seq, rehearsal: 10) do |n|
REXML::Document.new('<!DOCTYPE rubynet [<!ENTITY rbconfig.ruby_version "' + '>' * n + '">')
begin
REXML::Document.new('<!DOCTYPE rubynet [<!ENTITY rbconfig.ruby_version "' + '>' * n + '">')
rescue
end
end
end
end
Expand Down

0 comments on commit f946711

Please sign in to comment.