Class: TestIndentedXmlMarkup::TestUtfMarkup
- Inherits:
-
Builder::Test
- Object
- Minitest::Runnable
- Minitest::Test
- Builder::Test
- TestIndentedXmlMarkup::TestUtfMarkup
- 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
Instance Attribute Summary
Attributes inherited from Minitest::Runnable
Instance Method Summary collapse
- #encode(string, encoding) ⇒ Object
- #setup ⇒ Object
- #teardown ⇒ Object
- #test_use_entities_if_encoding_is_utf_but_kcode_is_not ⇒ Object
- #test_use_entities_if_kcode_is_utf_but_encoding_is_dummy_encoding ⇒ Object
- #test_use_entities_if_kcode_is_utf_but_encoding_is_unsupported_encoding ⇒ Object
-
#test_use_entities_if_no_encoding_is_given_and_kcode_is_none ⇒ Object
change in behavior.
- #test_use_utf8_if_both_encoding_and_kcode_are_utf8 ⇒ Object
- #test_use_utf8_if_both_encoding_and_kcode_are_utf8_with_lowercase ⇒ Object
- #test_use_utf8_if_encoding_defaults_and_kcode_is_utf8 ⇒ Object
Methods inherited from Builder::Test
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
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
#encode(string, encoding) ⇒ Object
503 504 505 506 507 508 509 510 511 512 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 503 def encode string, encoding if !String.method_defined?(:encode) $KCODE = encoding string elsif encoding == 'UTF8' string.dup.force_encoding('UTF-8') else string end end |
#setup ⇒ Object
463 464 465 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 463 def setup @old_kcode = $KCODE end |
#teardown ⇒ Object
467 468 469 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 467 def teardown $KCODE = @old_kcode end |
#test_use_entities_if_encoding_is_utf_but_kcode_is_not ⇒ Object
478 479 480 481 482 483 484 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 478 def test_use_entities_if_encoding_is_utf_but_kcode_is_not $KCODE = 'NONE' xml = Builder::XmlMarkup.new xml.instruct!(:xml, :encoding => 'UTF-8') xml.p("\xE2\x80\x99") assert_match(%r(<p>’</p>), xml.target!) # end |
#test_use_entities_if_kcode_is_utf_but_encoding_is_dummy_encoding ⇒ Object
514 515 516 517 518 519 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 514 def test_use_entities_if_kcode_is_utf_but_encoding_is_dummy_encoding xml = Builder::XmlMarkup.new xml.instruct!(:xml, :encoding => 'UTF-16') xml.p(encode("\xE2\x80\x99", 'UTF8')) assert_match(%r(<p>’</p>), xml.target!) # end |
#test_use_entities_if_kcode_is_utf_but_encoding_is_unsupported_encoding ⇒ Object
521 522 523 524 525 526 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 521 def test_use_entities_if_kcode_is_utf_but_encoding_is_unsupported_encoding xml = Builder::XmlMarkup.new xml.instruct!(:xml, :encoding => 'UCS-2') xml.p(encode("\xE2\x80\x99", 'UTF8')) assert_match(%r(<p>’</p>), xml.target!) # end |
#test_use_entities_if_no_encoding_is_given_and_kcode_is_none ⇒ Object
change in behavior. As there is no $KCODE anymore, the default moves from “does not understand utf-8” to “supports utf-8”.
489 490 491 492 493 494 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 489 def test_use_entities_if_no_encoding_is_given_and_kcode_is_none $KCODE = 'NONE' xml = Builder::XmlMarkup.new xml.p("\xE2\x80\x99") assert_match(%r(<p>’</p>), xml.target!) # end |
#test_use_utf8_if_both_encoding_and_kcode_are_utf8 ⇒ Object
534 535 536 537 538 539 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 534 def test_use_utf8_if_both_encoding_and_kcode_are_utf8 xml = Builder::XmlMarkup.new xml.instruct!(:xml, :encoding => 'UTF-8') xml.p(encode("\xE2\x80\x99",'UTF8')) assert_match encode("<p>\xE2\x80\x99</p>",'UTF8'), xml.target! end |
#test_use_utf8_if_both_encoding_and_kcode_are_utf8_with_lowercase ⇒ Object
541 542 543 544 545 546 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 541 def test_use_utf8_if_both_encoding_and_kcode_are_utf8_with_lowercase xml = Builder::XmlMarkup.new xml.instruct!(:xml, :encoding => 'utf-8') xml.p(encode("\xE2\x80\x99",'UTF8')) assert_match encode("<p>\xE2\x80\x99</p>",'UTF8'), xml.target! end |
#test_use_utf8_if_encoding_defaults_and_kcode_is_utf8 ⇒ Object
528 529 530 531 532 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_markupbuilder.rb', line 528 def test_use_utf8_if_encoding_defaults_and_kcode_is_utf8 xml = Builder::XmlMarkup.new xml.p(encode("\xE2\x80\x99",'UTF8')) assert_equal encode("<p>\xE2\x80\x99</p>",'UTF8'), xml.target! end |