Class: TestDeclarations

Inherits:
Builder::Test show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb

Constant Summary

Constants inherited from Minitest::Test

Minitest::Test::PASSTHROUGH_EXCEPTIONS, Minitest::Test::SETUP_METHODS, Minitest::Test::TEARDOWN_METHODS

Constants included from Minitest::Assertions

Minitest::Assertions::E, Minitest::Assertions::UNDEFINED

Constants inherited from Minitest::Runnable

Minitest::Runnable::SIGNALS

Instance Attribute Summary

Attributes inherited from Minitest::Runnable

#assertions, #failures, #time

Instance Method Summary collapse

Methods inherited from Builder::Test

#assert_nothing_raised

Methods inherited from Minitest::Test

#capture_exceptions, #class_name, #clean, i_suck_and_my_tests_are_order_dependent!, make_my_diffs_pretty!, #neuter_exception, #new_exception, parallelize_me!, #run, runnable_methods, #sanitize_exception, test_order, #with_empty_backtrace_filter, #with_info_handler

Methods included from Minitest::Guard

#jruby?, #maglev?, #mri?, #osx?, #rubinius?, #windows?

Methods included from Minitest::Test::LifecycleHooks

#after_setup, #after_teardown, #before_setup, #before_teardown, #teardown

Methods included from Minitest::Reportable

#class_name, #error?, #location, #passed?, #result_code, #skipped?

Methods included from Minitest::Assertions

#_synchronize, #assert, #assert_empty, #assert_equal, #assert_in_delta, #assert_in_epsilon, #assert_includes, #assert_instance_of, #assert_kind_of, #assert_match, #assert_mock, #assert_nil, #assert_operator, #assert_output, #assert_path_exists, #assert_predicate, #assert_raises, #assert_respond_to, #assert_same, #assert_send, #assert_silent, #assert_throws, #capture_io, #capture_subprocess_io, #diff, diff, diff=, #exception_details, #fail_after, #flunk, #message, #mu_pp, #mu_pp_for_diff, #pass, #refute, #refute_empty, #refute_equal, #refute_in_delta, #refute_in_epsilon, #refute_includes, #refute_instance_of, #refute_kind_of, #refute_match, #refute_nil, #refute_operator, #refute_path_exists, #refute_predicate, #refute_respond_to, #refute_same, #skip, #skip_until, #skipped?, #things_to_diff

Methods inherited from Minitest::Runnable

#failure, inherited, #initialize, #marshal_dump, #marshal_load, methods_matching, #name, #name=, on_signal, #passed?, reset, #result_code, run, #run, run_one_method, runnable_methods, runnables, #skipped?, #time_it, #whatever, with_info_handler

Constructor Details

This class inherits a constructor from Minitest::Runnable

Instance Method Details

#setupObject



305
306
307
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 305

def setup
  @xml = Builder::XmlMarkup.new(:indent=>2)
end

#test_bare_argObject



314
315
316
317
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 314

def test_bare_arg
  @xml.declare! :element, :arg
  assert_equal"<!element arg>\n", @xml.target!
end

#test_complex_declarationObject



344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 344

def test_complex_declaration
  @xml.declare! :DOCTYPE, :chapter do |x|
    x.declare! :ELEMENT, :chapter, "(title,para+)".intern
    x.declare! :ELEMENT, :title, "(#PCDATA)".intern
    x.declare! :ELEMENT, :para, "(#PCDATA)".intern
  end
  expected = %{<!DOCTYPE chapter [
<!ELEMENT chapter (title,para+)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT para (#PCDATA)>
]>
}
  assert_equal expected, @xml.target!
end

#test_declareObject



309
310
311
312
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 309

def test_declare
  @xml.declare! :element
  assert_equal "<!element>\n", @xml.target!
end

#test_mixed_argsObject



324
325
326
327
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 324

def test_mixed_args
  @xml.declare! :element, :x, "y", :z, "-//OASIS//DTD DocBook XML//EN"
  assert_equal "<!element x \"y\" z \"-//OASIS//DTD DocBook XML//EN\">\n", @xml.target!
end

#test_nested_declarationsObject



329
330
331
332
333
334
335
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 329

def test_nested_declarations
  @xml = Builder::XmlMarkup.new
  @xml.declare! :DOCTYPE, :chapter do |x|
    x.declare! :ELEMENT, :chapter, "(title,para+)".intern
  end
  assert_equal "<!DOCTYPE chapter [<!ELEMENT chapter (title,para+)>]>", @xml.target!
end

#test_nested_indented_declarationsObject



337
338
339
340
341
342
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 337

def test_nested_indented_declarations
  @xml.declare! :DOCTYPE, :chapter do |x|
    x.declare! :ELEMENT, :chapter, "(title,para+)".intern
  end
  assert_equal "<!DOCTYPE chapter [\n  <!ELEMENT chapter (title,para+)>\n]>\n", @xml.target!
end

#test_string_argObject



319
320
321
322
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 319

def test_string_arg
  @xml.declare! :element, "string"
  assert_equal"<!element \"string\">\n", @xml.target!
end