nokogiri 1.6.2.rc2 → 1.6.2.rc3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

@@ -174,11 +174,11 @@ module Nokogiri
174
174
  end
175
175
 
176
176
  def test_nth_child_selectors
177
- assert_xpath '//a[count(preceding-sibling::*) = 0]', @parser.parse('a:first-child')
178
- assert_xpath '//a[count(preceding-sibling::*) = 98]', @parser.parse('a:nth-child(99)')
179
- assert_xpath '//a[count(following-sibling::*) = 0]', @parser.parse('a:last-child')
180
- assert_xpath '//a[count(following-sbiling::*) = 0]', @parser.parse('a:nth-last-child(1)')
181
- assert_xpath '//a[count(following-sbiling::*) = 98]', @parser.parse('a:nth-last-child(99)')
177
+ assert_xpath '//a[count(preceding-sibling::*) = 0]', @parser.parse('a:first-child')
178
+ assert_xpath '//a[count(preceding-sibling::*) = 98]', @parser.parse('a:nth-child(99)')
179
+ assert_xpath '//a[count(following-sibling::*) = 0]', @parser.parse('a:last-child')
180
+ assert_xpath '//a[count(following-sibling::*) = 0]', @parser.parse('a:nth-last-child(1)')
181
+ assert_xpath '//a[count(following-sibling::*) = 98]', @parser.parse('a:nth-last-child(99)')
182
182
  end
183
183
 
184
184
  def test_miscellaneous_selectors
@@ -164,6 +164,12 @@ module Nokogiri
164
164
  assert_match %r% \n<div>b</div> *%, fragment.to_s
165
165
  end
166
166
 
167
+ def test_html_fragment_with_input_and_intermediate_whitespace
168
+ doc = "<label>Label</label><input type=\"text\"> <span>span</span>"
169
+ fragment = Nokogiri::HTML::Document.new.fragment(doc)
170
+ assert_equal "<label>Label</label><input type=\"text\"> <span>span</span>", fragment.to_s
171
+ end
172
+
167
173
  def test_html_fragment_with_leading_text_and_newline
168
174
  fragment = HTML::Document.new.fragment("First line\nSecond line<br>Broken line")
169
175
  assert_equal fragment.to_s, "First line\nSecond line<br>Broken line"
@@ -0,0 +1,24 @@
1
+ require "helper"
2
+
3
+ module Nokogiri
4
+ module XML
5
+ class TestAliasedDefaultNamespaces < Nokogiri::TestCase
6
+ def setup
7
+ super
8
+ end
9
+
10
+ def test_alised_default_namespace_on_parse
11
+ doc = Nokogiri::XML('<apple xmlns="ns:fruit" xmlns:fruit="ns:fruit" />')
12
+ ns = doc.root.namespaces
13
+ assert_equal "ns:fruit", ns["xmlns:fruit"], "Should have parsed aliased default namespace"
14
+ end
15
+
16
+ def test_add_aliased_default_namespace
17
+ doc = Nokogiri::XML('<apple xmlns="ns:fruit" />')
18
+ doc.root.add_namespace_definition("fruit", "ns:fruit")
19
+ ns = doc.root.namespaces
20
+ assert_equal "ns:fruit", ns["xmlns:fruit"],"Should have added aliased default namespace"
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,31 @@
1
+ require "helper"
2
+
3
+ module Nokogiri
4
+ module XML
5
+ class TestNamespacePreservation < Nokogiri::TestCase
6
+
7
+ def setup
8
+ @xml = Nokogiri.XML <<-eoxml
9
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
10
+ <xs:element xmlns:quer="http://api.geotrust.com/webtrust/query"/>
11
+ <xs:element xmlns:quer="http://api.geotrust.com/webtrust/query"/>
12
+ </xs:schema>
13
+ eoxml
14
+ end
15
+
16
+ def test_xpath
17
+ first = @xml.at_xpath('//xs:element', 'xs' => 'http://www.w3.org/2001/XMLSchema')
18
+ last = @xml.at_xpath('//xs:element[last()]', 'xs' => 'http://www.w3.org/2001/XMLSchema')
19
+ assert_equal 'http://api.geotrust.com/webtrust/query' , first.namespaces['xmlns:quer'], "Should contain quer namespace"
20
+ assert_equal 'http://api.geotrust.com/webtrust/query' , last.namespaces['xmlns:quer'], "Should contain quer namespace"
21
+ end
22
+
23
+ def test_traversing
24
+ first = @xml.root.element_children.first
25
+ last = @xml.root.element_children.last
26
+ assert_equal 'http://api.geotrust.com/webtrust/query' , first.namespaces['xmlns:quer'], "Should contain quer namespace"
27
+ assert_equal 'http://api.geotrust.com/webtrust/query' , last.namespaces['xmlns:quer'], "Should contain quer namespace"
28
+ end
29
+ end
30
+ end
31
+ end
@@ -40,6 +40,21 @@ module Nokogiri
40
40
  assert_equal('& <foo> &amp;', node.content)
41
41
  assert_equal('&amp; &lt;foo&gt; &amp;amp;', node.to_xml)
42
42
  end
43
+
44
+ def test_add_child
45
+ node = Text.new('foo', Document.new)
46
+ if Nokogiri.jruby?
47
+ exc = RuntimeError
48
+ else
49
+ exc = ArgumentError
50
+ end
51
+ assert_raises(exc) {
52
+ node.add_child Text.new('bar', Document.new)
53
+ }
54
+ assert_raises(exc) {
55
+ node << Text.new('bar', Document.new)
56
+ }
57
+ end
43
58
  end
44
59
  end
45
60
  end
data/test_all CHANGED
@@ -10,7 +10,7 @@
10
10
  # (e.g., 1.9.3's glob_helper). ["rake test:valgrind:suppression"]
11
11
  #
12
12
 
13
- RUBIES="ruby-1.9.3-p327 jruby-1.7.3 jruby-1.6.5.1 jruby-1.6.7.2 ruby-1.9.2-p320"
13
+ RUBIES="ruby-1.9.3 ruby-1.9.2 ruby-2.0 ruby-2.1 jruby-1.7"
14
14
  TEST_LOG=test.log
15
15
  VALGRIND_LOG=valgrind.log
16
16
 
@@ -34,7 +34,7 @@ function rvm_use {
34
34
 
35
35
  function generate_parser_and_tokenizer {
36
36
  old_ruby=$current_ruby
37
- rvm_use ruby-1.9.3-p327
37
+ rvm_use ruby-1.9.3
38
38
  bundle exec rake generate 2>&1 > /dev/null
39
39
  rvm_use $old_ruby
40
40
  }
@@ -51,7 +51,7 @@ function compile {
51
51
 
52
52
  for ruby in $RUBIES ; do
53
53
  rvm_use ${ruby}
54
- if ! which bundle ; then
54
+ if ! [[ $(bundle -v) =~ "1.6." ]] ; then
55
55
  gem install bundler
56
56
  fi
57
57
  bundle install --quiet --local || bundle install
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2.rc2
4
+ version: 1.6.2.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-04-10 00:00:00.000000000 Z
15
+ date: 2014-05-09 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: mini_portile
@@ -404,6 +404,7 @@ files:
404
404
  - ports/patches/libxml2/0007-Enforce-XML_PARSER_EOF-state-handling-through-the-pa.patch
405
405
  - ports/patches/libxml2/0008-Improve-handling-of-xmlStopParser.patch
406
406
  - ports/patches/libxml2/0009-Fix-a-couple-of-return-without-value.patch
407
+ - ports/patches/libxml2/0010-Keep-non-significant-blanks-node-in-HTML-parser.patch
407
408
  - ports/patches/libxslt/0001-Adding-doc-update-related-to-1.1.28.patch
408
409
  - ports/patches/libxslt/0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch
409
410
  - ports/patches/libxslt/0003-Initialize-pseudo-random-number-generator-with-curre.patch
@@ -474,10 +475,12 @@ files:
474
475
  - test/html/test_node.rb
475
476
  - test/html/test_node_encoding.rb
476
477
  - test/namespaces/test_additional_namespaces_in_builder_doc.rb
478
+ - test/namespaces/test_namespaces_aliased_default.rb
477
479
  - test/namespaces/test_namespaces_in_builder_doc.rb
478
480
  - test/namespaces/test_namespaces_in_cloned_doc.rb
479
481
  - test/namespaces/test_namespaces_in_created_doc.rb
480
482
  - test/namespaces/test_namespaces_in_parsed_doc.rb
483
+ - test/namespaces/test_namespaces_preservation.rb
481
484
  - test/test_convert_xpath.rb
482
485
  - test/test_css_cache.rb
483
486
  - test/test_encoding_handler.rb
@@ -614,7 +617,9 @@ test_files:
614
617
  - test/css/test_xpath_visitor.rb
615
618
  - test/test_encoding_handler.rb
616
619
  - test/namespaces/test_namespaces_in_parsed_doc.rb
620
+ - test/namespaces/test_namespaces_aliased_default.rb
617
621
  - test/namespaces/test_namespaces_in_cloned_doc.rb
622
+ - test/namespaces/test_namespaces_preservation.rb
618
623
  - test/namespaces/test_namespaces_in_created_doc.rb
619
624
  - test/namespaces/test_additional_namespaces_in_builder_doc.rb
620
625
  - test/namespaces/test_namespaces_in_builder_doc.rb