libxml-ruby 4.0.0-x64-mingw-ucrt → 4.1.1-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15167370942fc862a4602c9bfc1fd35f46562cad3a43093ac5249d679791fb69
4
- data.tar.gz: d4f29d60c2d528405b520f68c4c47b60f6dbd42276571d7044835395b7499d29
3
+ metadata.gz: d6eefbf4cf6f18a76d82973c0c297dd1ef37892a83ec1eea6b2b8a041e51a905
4
+ data.tar.gz: 427764544b4ca067c643cb9d504502dc56d22c4a722be2b7248016edd282b098
5
5
  SHA512:
6
- metadata.gz: b991a82a321d37111acf48e9115c8feb87d2481cd6a4fbdf52d769020b5585d6bfa60bcc5aa09358726ce1172622d53e861dc36f29da91fe0c2d709b26dd17e1
7
- data.tar.gz: 7f9f1b54201198b74590d39544cf330939aa930021281a73dd85a20d56088dc2926a40a67bffb0dc52f0d3768d888552574f41ec2b51f13f2a2acfee8ad774b5
6
+ metadata.gz: 9314838d6d6cbe1f0d87e48d2037ec3ad20eb70371f8022f5244a9a15b3d515bd901e577ebae90a39e7a36667bc5a0505e4ccc210471c3787dbf788adb396ec4
7
+ data.tar.gz: f1409c4f6e05cdd89e1596f49760b62ef1a65d22da343913488e74ee9d52c6a7c87019ceb61f958b1217064249d0f9a1ce3ee2fbd776ff234c67543a1ecd1d81
data/HISTORY CHANGED
@@ -1,5 +1,15 @@
1
1
  = Release History
2
2
 
3
+ == 4.1.1 / 2023-05-01
4
+
5
+ * Fix compile warning (or error) for input_callbacks_register_input_callbacks (Charlie Savage)
6
+ * Remove call to deprecated function htmlDefaultSAXHandlerInit (Charlie Savage)
7
+
8
+ == 4.1.0 / 2023-04-30
9
+
10
+ * Fix compile warning (or error) for rxml_encoding_to_rb_encoding (Charlie Savage)
11
+ * Breaking - Remove LibXML::XML.features since its uses functionality deprecated in LibXML (Charlie Savage)
12
+
3
13
  == 4.0.0 / 2022-12-28
4
14
 
5
15
  * Breaking - Remove support for XPointer since libxml2 has deprecated it and will remove it (Charlie Savage)
@@ -757,45 +757,6 @@ static VALUE rxml_default_save_no_empty_tags_set(VALUE klass, VALUE value)
757
757
  }
758
758
  }
759
759
 
760
- /*
761
- * call-seq:
762
- * XML.features -> ["feature", ..., "feature"]
763
- *
764
- * Obtains an array of strings representing features supported
765
- * (and enabled) by the installed libxml.
766
- */
767
- static VALUE rxml_features(VALUE klass)
768
- {
769
- #ifndef LIBXML_LEGACY_ENABLED
770
- return Qnil;
771
- #else
772
- VALUE arr, str;
773
- int i, len = MAX_LIBXML_FEATURES_LEN;
774
- char **list = NULL;
775
-
776
- list = ALLOC_N(char *,MAX_LIBXML_FEATURES_LEN);
777
- MEMZERO(list, char *, MAX_LIBXML_FEATURES_LEN);
778
-
779
- arr = rb_ary_new();
780
- if (xmlGetFeaturesList(&len, (const char **) list) == -1)
781
- return Qnil;
782
-
783
- for (i = 0; i < len; i++)
784
- {
785
- str = rb_str_new2((const char *) list[i]);
786
- rb_gc_unregister_address(&str);
787
- rb_ary_push(arr, str);
788
- }
789
-
790
- if (len == MAX_LIBXML_FEATURES_LEN)
791
- rb_warn(
792
- "Please contact libxml-devel@rubyforge.org and ask to have the \"MAX_LIBXML_FEATURES_LEN increased\" because you could possibly be seeing an incomplete list");
793
-
794
- ruby_xfree(list);
795
- return (arr);
796
- #endif /* LIBXML_LEGACY_ENABLED */
797
- }
798
-
799
760
  /*
800
761
  * call-seq:
801
762
  * XML.indent_tree_output -> (true|false)
@@ -931,7 +892,6 @@ void rxml_init_xml(void)
931
892
  rb_define_module_function(mXML, "default_warnings=", rxml_default_warnings_set, 1);
932
893
  rb_define_module_function(mXML, "default_save_no_empty_tags", rxml_default_save_no_empty_tags_get, 0);
933
894
  rb_define_module_function(mXML, "default_save_no_empty_tags=", rxml_default_save_no_empty_tags_set, 1);
934
- rb_define_module_function(mXML, "features", rxml_features, 0);
935
895
  rb_define_module_function(mXML, "indent_tree_output", rxml_indent_tree_output_get, 0);
936
896
  rb_define_module_function(mXML, "indent_tree_output=", rxml_indent_tree_output_set, 1);
937
897
  rb_define_module_function(mXML, "memory_dump", rxml_memory_dump, 0);
@@ -197,7 +197,7 @@ void rxml_init_encoding(void)
197
197
  rb_define_module_function(mXMLEncoding, "from_s", rxml_encoding_from_s, 1);
198
198
  rb_define_module_function(mXMLEncoding, "to_s", rxml_encoding_to_s, 1);
199
199
 
200
- rb_define_module_function(mXMLEncoding, "to_rb_encoding", rxml_encoding_to_rb_encoding, 2);
200
+ rb_define_module_function(mXMLEncoding, "to_rb_encoding", rxml_encoding_to_rb_encoding, 1);
201
201
 
202
202
  /* -1: No char encoding detected. */
203
203
  rb_define_const(mXMLEncoding, "ERROR", INT2NUM(XML_CHAR_ENCODING_ERROR));
@@ -44,7 +44,7 @@ static ID ERROR_HANDLER_ID;
44
44
  * Returns the proc that will be called when libxml generates
45
45
  * warning, error or fatal error messages.
46
46
  */
47
- static VALUE rxml_error_get_handler(void)
47
+ static VALUE rxml_error_get_handler(VALUE self)
48
48
  {
49
49
  VALUE block = rb_cvar_get(eXMLError, ERROR_HANDLER_ID);
50
50
  return block;
@@ -102,7 +102,7 @@ static void structuredErrorFunc(void *userData, xmlErrorPtr xerror)
102
102
  VALUE error = rxml_error_wrap(xerror);
103
103
 
104
104
  /* Wrap error up as Ruby object and send it off to ruby */
105
- VALUE block = rxml_error_get_handler();
105
+ VALUE block = rxml_error_get_handler(error);
106
106
 
107
107
  /* Now call global handler */
108
108
  if (block != Qnil)
@@ -243,7 +243,6 @@ static VALUE rxml_html_parser_context_string(VALUE klass, VALUE string)
243
243
  sets to 0 and xmlCtxtUseOptionsInternal sets to 1. So we have to call both. */
244
244
  htmlCtxtUseOptions(ctxt, rxml_libxml_default_options());
245
245
 
246
- htmlDefaultSAXHandlerInit();
247
246
  if (ctxt->sax != NULL)
248
247
  memcpy(ctxt->sax, &htmlDefaultSAXHandler, sizeof(xmlSAXHandlerV1));
249
248
 
@@ -88,7 +88,7 @@ int ic_close(void *context)
88
88
  *
89
89
  * Register a new set of I/O callback for handling parser input.
90
90
  */
91
- static VALUE input_callbacks_register_input_callbacks(void)
91
+ static VALUE input_callbacks_register_input_callbacks(VALUE self)
92
92
  {
93
93
  xmlRegisterInputCallbacks(ic_match, ic_open, ic_read, ic_close);
94
94
  return (Qtrue);
@@ -182,10 +182,7 @@ void rxml_init_input_callbacks(void)
182
182
  cInputCallbacks = rb_define_class_under(mXML, "InputCallbacks", rb_cObject);
183
183
 
184
184
  /* Class Methods */
185
- rb_define_singleton_method(cInputCallbacks, "register",
186
- input_callbacks_register_input_callbacks, 0);
187
- rb_define_singleton_method(cInputCallbacks, "add_scheme",
188
- input_callbacks_add_scheme, 2);
189
- rb_define_singleton_method(cInputCallbacks, "remove_scheme",
190
- input_callbacks_remove_scheme, 1);
185
+ rb_define_singleton_method(cInputCallbacks, "register", input_callbacks_register_input_callbacks, 0);
186
+ rb_define_singleton_method(cInputCallbacks, "add_scheme", input_callbacks_add_scheme, 2);
187
+ rb_define_singleton_method(cInputCallbacks, "remove_scheme", input_callbacks_remove_scheme, 1);
191
188
  }
@@ -3,8 +3,6 @@
3
3
  #ifndef __RXML_PARSER__
4
4
  #define __RXML_PARSER__
5
5
 
6
- #define MAX_LIBXML_FEATURES_LEN 50
7
-
8
6
  extern VALUE cXMLParser;
9
7
 
10
8
  void rxml_init_parser();
@@ -3,8 +3,6 @@
3
3
  #ifndef __RXML_PARSER_OPTIONS__
4
4
  #define __RXML_PARSER_OPTIONS__
5
5
 
6
- #define MAX_LIBXML_FEATURES_LEN 50
7
-
8
6
  extern VALUE mXMLParserOptions;
9
7
 
10
8
  void rxml_init_parser_options();
@@ -1,9 +1,9 @@
1
1
  /* Don't nuke this block! It is used for automatically updating the
2
2
  * versions below. VERSION = string formatting, VERNUM = numbered
3
3
  * version for inline testing: increment both or none at all.*/
4
- #define RUBY_LIBXML_VERSION "4.0.0"
4
+ #define RUBY_LIBXML_VERSION "4.1.1"
5
5
  #define RUBY_LIBXML_VERNUM 400
6
6
  #define RUBY_LIBXML_VER_MAJ 4
7
- #define RUBY_LIBXML_VER_MIN 0
8
- #define RUBY_LIBXML_VER_MIC 0
7
+ #define RUBY_LIBXML_VER_MIN 1
8
+ #define RUBY_LIBXML_VER_MIC 1
9
9
  #define RUBY_LIBXML_VER_PATCH 0
Binary file
Binary file
data/lib/libxml/error.rb CHANGED
@@ -3,24 +3,24 @@
3
3
  module LibXML
4
4
  module XML
5
5
  class Error
6
- # Create mapping from domain constant value to keys
6
+ # Create mapping from domain constant values to keys
7
7
  DOMAIN_CODE_MAP = [:NO_ERROR, :PARSER, :TREE, :NAMESPACE, :DTD, :HTML, :MEMORY,
8
8
  :OUTPUT, :IO, :FTP, :HTTP, :XINCLUDE, :XPATH, :XPOINTER, :REGEXP,
9
9
  :DATATYPE, :SCHEMASP, :SCHEMASV, :RELAXNGP, :RELAXNGV, :CATALOG,
10
10
  :C14N, :XSLT, :VALID, :CHECK, :WRITER, :MODULE, :I18N, :SCHEMATRONV].inject(Hash.new) do |hash, code|
11
11
  if const_defined?(code)
12
- hash[const_get(code)] = code.to_s
12
+ hash[const_get(code)] = code
13
13
  end
14
14
  hash
15
15
  end
16
16
 
17
- # Create mapping from domain constant value to keys
17
+ # Create mapping from error constant values (so need to remove domain_codes) to keys
18
18
  ERROR_CODE_MAP = Hash.new.tap do |map|
19
19
  (constants -
20
20
  DOMAIN_CODE_MAP.values - #Domains
21
21
  [:NONE, :WARNING, :ERROR, :FATAL] # Levels
22
22
  ).each do |code|
23
- map[const_get(code)] = code.to_s
23
+ map[const_get(code)] = code
24
24
  end
25
25
  end
26
26
 
@@ -70,11 +70,11 @@ module LibXML
70
70
  end
71
71
 
72
72
  def domain_to_s
73
- DOMAIN_CODE_MAP[self.domain]
73
+ DOMAIN_CODE_MAP[self.domain].to_s
74
74
  end
75
75
 
76
76
  def code_to_s
77
- ERROR_CODE_MAP[self.code]
77
+ ERROR_CODE_MAP[self.code].to_s
78
78
  end
79
79
 
80
80
  def to_s
@@ -92,4 +92,4 @@ module LibXML
92
92
  end
93
93
  end
94
94
 
95
- LibXML::XML::Error.set_handler(&LibXML::XML::Error::VERBOSE_HANDLER)
95
+ LibXML::XML::Error.set_handler(&LibXML::XML::Error::VERBOSE_HANDLER)
data/test/test_error.rb CHANGED
@@ -4,135 +4,153 @@ require_relative './test_helper'
4
4
  require 'stringio'
5
5
 
6
6
  class TestError < Minitest::Test
7
- # def test_error_codes
8
- # assert_equal(4, LibXML::XML::Error::DTD)
9
- # assert_equal(4, LibXML::XML::Error.const_get('DTD'))
10
- #
11
- # assert_equal(4, LibXML::XML::Error::DOCUMENT_EMPTY)
12
- # assert_equal(4, LibXML::XML::Error.const_get('DOCUMENT_EMPTY'))
13
- # end
14
- #
15
- # def test_invalid_handler
16
- # assert_raises(RuntimeError) do
17
- # LibXML::XML::Error.set_handler
18
- # end
19
- # end
20
- #
21
- # def test_handler
22
- # exception = nil
23
- # LibXML::XML::Error.set_handler do |error|
24
- # exception = error
25
- # end
26
- #
27
- # # Raise the error
28
- # error = assert_raises(LibXML::XML::Error) do
29
- # LibXML::XML::Reader.string('<foo').read
30
- # end
31
- # assert_equal(exception, error)
32
- #
33
- # # Check the handler worked
34
- # refute_nil(exception)
35
- # assert_kind_of(LibXML::XML::Error, exception)
36
- # assert_equal("Fatal error: Couldn't find end of Start Tag foo at :1.", exception.message)
37
- # assert_equal(LibXML::XML::Error::PARSER, exception.domain)
38
- # assert_equal(LibXML::XML::Error::GT_REQUIRED, exception.code)
39
- # assert_equal(LibXML::XML::Error::FATAL, exception.level)
40
- # assert_nil(exception.file)
41
- # assert_equal(1, exception.line)
42
- # assert_equal('foo', exception.str1)
43
- # assert_nil(exception.str2)
44
- # assert_nil(exception.str3)
45
- # assert_equal(0, exception.int1)
46
- # assert_equal(5, exception.int2)
47
- # assert_nil(exception.node)
48
- # end
49
- #
50
- # def test_reset_handler
51
- # exception = nil
52
- # LibXML::XML::Error.set_handler do |error|
53
- # exception = error
54
- # end
55
- #
56
- # LibXML::XML::Error.reset_handler
57
- # LibXML::XML::Reader.string('<foo')
58
- # assert_nil(exception)
59
- # end
60
- #
61
- # def test_get_handler
62
- # assert_respond_to(LibXML::XML::Error, :get_handler)
63
- # assert_equal(0, LibXML::XML::Error.method(:get_handler).arity)
64
- #
65
- # saved_handler = LibXML::XML::Error.get_handler
66
- # LibXML::XML::Error.set_handler{ puts "New handler" }
67
- # refute_equal(LibXML::XML::Error.get_handler, saved_handler)
68
- #
69
- # LibXML::XML::Error.set_handler(&saved_handler)
70
- # assert_equal(LibXML::XML::Error.get_handler, saved_handler)
71
- # end
72
- #
73
- # def test_verbose_handler
74
- # LibXML::XML::Error.set_handler(&LibXML::XML::Error::VERBOSE_HANDLER)
75
- # output = StringIO.new
76
- # original_stderr = Object::STDERR
77
- #
78
- # Object.const_set(:STDERR, output)
79
- # begin
80
- # assert_raises(LibXML::XML::Error) do
81
- # LibXML::XML::Parser.string('<foo><bar/></foz>').parse
82
- # end
83
- # ensure
84
- # Object.const_set(:STDERR, original_stderr)
85
- # end
86
- # assert_equal("Fatal error: Opening and ending tag mismatch: foo line 1 and foz at :1.\n", output.string)
87
- # end
88
- #
89
- # def test_no_hanlder
90
- # LibXML::XML::Error.reset_handler
91
- # output = StringIO.new
92
- # original_stderr = Object::STDERR
93
- #
94
- # Object.const_set(:STDERR, output)
95
- # begin
96
- # assert_raises(LibXML::XML::Error) do
97
- # LibXML::XML::Parser.string('<foo><bar/></foz>').parse
98
- # end
99
- # ensure
100
- # Object.const_set(:STDERR, original_stderr)
101
- # end
102
- # assert_equal('', output.string)
103
- # end
104
- #
105
- # def test_parse_error
106
- # exception = assert_raises(LibXML::XML::Error) do
107
- # LibXML::XML::Parser.string('<foo><bar/></foz>').parse
108
- # end
109
- #
110
- # assert_instance_of(LibXML::XML::Error, exception)
111
- # assert_equal("Fatal error: Opening and ending tag mismatch: foo line 1 and foz at :1.", exception.message)
112
- # assert_equal(LibXML::XML::Error::PARSER, exception.domain)
113
- # assert_equal(LibXML::XML::Error::TAG_NAME_MISMATCH, exception.code)
114
- # assert_equal(LibXML::XML::Error::FATAL, exception.level)
115
- # assert_nil(exception.file)
116
- # assert_equal(1, exception.line)
117
- # end
118
- #
119
- # def test_xpath_error
120
- # doc = LibXML::XML::Document.file(File.join(File.dirname(__FILE__), 'model/soap.xml'))
121
- #
122
- # exception = assert_raises(LibXML::XML::Error) do
123
- # doc.find('/foo[bar=test')
124
- # end
125
- #
126
- # assert_instance_of(LibXML::XML::Error, exception)
127
- # assert_equal("Error: Invalid predicate.", exception.message)
128
- # assert_equal(LibXML::XML::Error::XPATH, exception.domain)
129
- # assert_equal(LibXML::XML::Error::XPATH_INVALID_PREDICATE_ERROR, exception.code)
130
- # assert_equal(LibXML::XML::Error::ERROR, exception.level)
131
- # assert_nil(exception.file)
132
- # assert_nil(nil)
133
- # end
7
+ def test_error_codes
8
+ assert_equal(4, LibXML::XML::Error::DTD)
9
+ assert_equal(4, LibXML::XML::Error.const_get('DTD'))
10
+
11
+ assert_equal(4, LibXML::XML::Error::DOCUMENT_EMPTY)
12
+ assert_equal(4, LibXML::XML::Error.const_get('DOCUMENT_EMPTY'))
13
+ end
14
+
15
+ def test_invalid_handler
16
+ assert_raises(RuntimeError) do
17
+ LibXML::XML::Error.set_handler
18
+ end
19
+ end
20
+
21
+ def test_handler
22
+ exception = nil
23
+ LibXML::XML::Error.set_handler do |error|
24
+ exception = error
25
+ end
26
+
27
+ # Raise the error
28
+ error = assert_raises(LibXML::XML::Error) do
29
+ LibXML::XML::Reader.string('<foo').read
30
+ end
31
+ assert_equal(exception, error)
32
+
33
+ # Check the handler worked
34
+ refute_nil(exception)
35
+ assert_kind_of(LibXML::XML::Error, exception)
36
+ assert_equal("Fatal error: Couldn't find end of Start Tag foo at :1.", exception.message)
37
+ assert_equal(LibXML::XML::Error::PARSER, exception.domain)
38
+ assert_equal(LibXML::XML::Error::GT_REQUIRED, exception.code)
39
+ assert_equal(LibXML::XML::Error::FATAL, exception.level)
40
+ assert_nil(exception.file)
41
+ assert_equal(1, exception.line)
42
+ assert_equal('foo', exception.str1)
43
+ assert_nil(exception.str2)
44
+ assert_nil(exception.str3)
45
+ assert_equal(0, exception.int1)
46
+ assert_equal(5, exception.int2)
47
+ assert_nil(exception.node)
48
+ end
49
+
50
+ def test_reset_handler
51
+ exception = nil
52
+ LibXML::XML::Error.set_handler do |error|
53
+ exception = error
54
+ end
55
+
56
+ LibXML::XML::Error.reset_handler
57
+ LibXML::XML::Reader.string('<foo')
58
+ assert_nil(exception)
59
+ end
60
+
61
+ def test_get_handler
62
+ assert_respond_to(LibXML::XML::Error, :get_handler)
63
+ assert_equal(0, LibXML::XML::Error.method(:get_handler).arity)
64
+
65
+ saved_handler = LibXML::XML::Error.get_handler
66
+ LibXML::XML::Error.set_handler { puts "New handler" }
67
+ refute_equal(LibXML::XML::Error.get_handler, saved_handler)
68
+
69
+ if saved_handler
70
+ LibXML::XML::Error.set_handler &saved_handler
71
+ else
72
+ LibXML::XML::Error.reset_handler
73
+ end
74
+
75
+ assert_equal(LibXML::XML::Error.get_handler, saved_handler)
76
+ end
77
+
78
+ def test_verbose_handler
79
+ LibXML::XML::Error.set_handler(&LibXML::XML::Error::VERBOSE_HANDLER)
80
+ output = StringIO.new
81
+ original_stderr = Object::STDERR
82
+
83
+ Object.const_set(:STDERR, output)
84
+ begin
85
+ assert_raises(LibXML::XML::Error) do
86
+ LibXML::XML::Parser.string('<foo><bar/></foz>').parse
87
+ end
88
+ ensure
89
+ Object.const_set(:STDERR, original_stderr)
90
+ end
91
+ assert_equal("Fatal error: Opening and ending tag mismatch: foo line 1 and foz at :1.\n", output.string)
92
+ end
93
+
94
+ def test_no_handler
95
+ LibXML::XML::Error.reset_handler
96
+ output = StringIO.new
97
+ original_stderr = Object::STDERR
98
+
99
+ Object.const_set(:STDERR, output)
100
+ begin
101
+ assert_raises(LibXML::XML::Error) do
102
+ LibXML::XML::Parser.string('<foo><bar/></foz>').parse
103
+ end
104
+ ensure
105
+ Object.const_set(:STDERR, original_stderr)
106
+ end
107
+ assert_equal('', output.string)
108
+ end
109
+
110
+ def test_parse_error
111
+ exception = assert_raises(LibXML::XML::Error) do
112
+ LibXML::XML::Parser.string('<foo><bar/></foz>').parse
113
+ end
114
+
115
+ assert_instance_of(LibXML::XML::Error, exception)
116
+ assert_equal("Fatal error: Opening and ending tag mismatch: foo line 1 and foz at :1.", exception.message)
117
+ assert_equal(LibXML::XML::Error::PARSER, exception.domain)
118
+ assert_equal(LibXML::XML::Error::TAG_NAME_MISMATCH, exception.code)
119
+ assert_equal(LibXML::XML::Error::FATAL, exception.level)
120
+ assert_nil(exception.file)
121
+ assert_equal(1, exception.line)
122
+ end
123
+
124
+ def test_xpath_error
125
+ doc = LibXML::XML::Document.file(File.join(File.dirname(__FILE__), 'model/soap.xml'))
126
+
127
+ exception = assert_raises(LibXML::XML::Error) do
128
+ doc.find('/foo[bar=test')
129
+ end
130
+
131
+ assert_instance_of(LibXML::XML::Error, exception)
132
+ assert_equal("Error: Invalid predicate.", exception.message)
133
+ assert_equal(LibXML::XML::Error::XPATH, exception.domain)
134
+ assert_equal(LibXML::XML::Error::XPATH_INVALID_PREDICATE_ERROR, exception.code)
135
+ assert_equal(LibXML::XML::Error::ERROR, exception.level)
136
+ assert_nil(exception.file)
137
+ assert_nil(nil)
138
+ end
134
139
 
135
140
  def test_double_parse
141
+ LibXML::XML::Error.set_handler {|msg| nil }
142
+ parser = LibXML::XML::Parser.string("<test>something</test>")
143
+ parser.parse
144
+
145
+ error = assert_raises(LibXML::XML::Error) do
146
+ # Try parsing a second time
147
+ parser.parse
148
+ end
149
+
150
+ assert_equal(" LibXML::XML::Error.", error.to_s)
151
+ end
152
+
153
+ def test_double_parse_register_handler
136
154
  LibXML::XML::Parser.register_error_handler(lambda {|msg| nil })
137
155
  parser = LibXML::XML::Parser.string("<test>something</test>")
138
156
  parser.parse
@@ -145,34 +163,32 @@ class TestError < Minitest::Test
145
163
  assert_equal(" LibXML::XML::Error.", error.to_s)
146
164
  end
147
165
 
148
- # def test_libxml_parser_empty_string
149
- # xp = LibXML::XML::Parser.new
150
- #
151
- # error = assert_raises(TypeError) do
152
- # xp.string = nil
153
- # end
154
- # assert_equal('wrong argument type nil (expected String)', error.to_s)
155
- #
156
- # error = assert_raises(ArgumentError) do
157
- # xp.string = ''
158
- # end
159
- # assert_equal('Must specify a string with one or more characters', error.to_s)
160
- # end
161
- #
162
- # def test_error_domain_to_s
163
- # exception = assert_raises(LibXML::XML::Error) do
164
- # LibXML::XML::Parser.string('<foo href="http://example.org/cgi?k1=v1&k2=v2"></foo>').parse
165
- # end
166
- #
167
- # assert_equal(LibXML::XML::Error::PARSER, exception.domain)
168
- # assert_equal("PARSER",exception.domain_to_s)
169
- # end
170
- #
171
- # def test_error_code_to_s
172
- # exception = assert_raises(LibXML::XML::Error) do
173
- # LibXML::XML::Parser.string('<foo href="http://example.org/cgi?k1=v1&k2=v2"></foo>').parse
174
- # end
175
- # assert_equal(LibXML::XML::Error::ENTITYREF_SEMICOL_MISSING, exception.code)
176
- # assert_equal("ENTITYREF_SEMICOL_MISSING",exception.code_to_s)
177
- # end
166
+ def test_libxml_parser_empty_string
167
+ error = assert_raises(TypeError) do
168
+ LibXML::XML::Parser.string(nil)
169
+ end
170
+ assert_equal('wrong argument type nil (expected String)', error.to_s)
171
+
172
+ error = assert_raises(ArgumentError) do
173
+ LibXML::XML::Parser.string("")
174
+ end
175
+ assert_equal('Must specify a string with one or more characters', error.to_s)
176
+ end
177
+
178
+ def test_error_domain_to_s
179
+ exception = assert_raises(LibXML::XML::Error) do
180
+ LibXML::XML::Parser.string('<foo href="http://example.org/cgi?k1=v1&k2=v2"></foo>').parse
181
+ end
182
+
183
+ assert_equal(LibXML::XML::Error::PARSER, exception.domain)
184
+ assert_equal("PARSER", exception.domain_to_s)
185
+ end
186
+
187
+ def test_error_code_to_s
188
+ exception = assert_raises(LibXML::XML::Error) do
189
+ LibXML::XML::Parser.string('<foo href="http://example.org/cgi?k1=v1&k2=v2"></foo>').parse
190
+ end
191
+ assert_equal(LibXML::XML::Error::ENTITYREF_SEMICOL_MISSING, exception.code)
192
+ assert_equal("ENTITYREF_SEMICOL_MISSING", exception.code_to_s)
193
+ end
178
194
  end
data/test/test_xml.rb CHANGED
@@ -249,14 +249,6 @@ class TestXml < Minitest::Test
249
249
  assert_instance_of(Integer, LibXML::XML::VERNUM)
250
250
  end
251
251
 
252
- def test_libxml_parser_features
253
- if windows?
254
- assert_nil(LibXML::XML.features)
255
- else
256
- assert_instance_of(Array, LibXML::XML.features)
257
- end
258
- end
259
-
260
252
  def test_default_options
261
253
  assert_equal(0, LibXML::XML.default_options)
262
254
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libxml-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.1
5
5
  platform: x64-mingw-ucrt
6
6
  authors:
7
7
  - Ross Bamform
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2022-12-28 00:00:00.000000000 Z
17
+ date: 2023-05-02 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rake-compiler