w3c_validators 1.3 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +13 -5
- data/.gitignore +2 -1
- data/CHANGELOG +8 -1
- data/README.md +48 -25
- data/lib/w3c_validators/feed_validator.rb +9 -3
- data/lib/w3c_validators/nu_validator.rb +4 -2
- data/lib/w3c_validators/validator.rb +32 -13
- data/lib/w3c_validators/version.rb +1 -1
- data/test/http_recording/feed_validating_uri_with_soap.yml +5 -5
- data/test/http_recording/html5_getting_request_data.yml +4 -4
- data/test/http_recording/html5_validating_file.yml +78 -0
- data/test/http_recording/html5_validating_text.yml +87 -0
- data/test/http_recording/html5_validating_text_via_file.yml +78 -0
- data/test/http_recording/html5_validating_uri.yml +27 -27
- data/test/http_recording/markup_debugging_uri.yml +3 -3
- data/test/http_recording/markup_overriding_charset.yml +1 -1
- data/test/http_recording/markup_overriding_charset_for_fallback_only.yml +3 -3
- data/test/http_recording/markup_overriding_doctype.yml +8 -8
- data/test/http_recording/markup_overriding_doctype_for_fallback_only.yml +3 -3
- data/test/http_recording/markup_validating_uri_with_head_request.yml +1 -1
- data/test/http_recording/markup_validating_uri_with_soap.yml +3 -3
- data/test/http_recording/markup_validator_abort.yml +1 -1
- data/test/http_recording/markup_validator_contains_details_of_error_conditions.yml +3 -3
- data/test/http_recording/markup_validator_html5_redirect.yml +101 -0
- data/test/test_feed_validator.rb +1 -1
- data/test/test_html5_validator.rb +27 -13
- data/test/test_markup_validator.rb +9 -9
- data/test/test_proxy.rb +1 -1
- data/test/tools/curl_nu.sh +12 -0
- metadata +23 -19
- data/Gemfile.lock +0 -43
data/test/test_feed_validator.rb
CHANGED
@@ -10,7 +10,7 @@ class FeedValidatorTests < Test::Unit::TestCase
|
|
10
10
|
|
11
11
|
def test_validating_uri_with_soap
|
12
12
|
VCR.use_cassette('feed_validating_uri_with_soap') do
|
13
|
-
r = @v.validate_uri('https://
|
13
|
+
r = @v.validate_uri('https://w3c-validators.github.io/w3c_validators/invalid_feed.xml')
|
14
14
|
assert_errors r, 1
|
15
15
|
assert_warnings r, 1
|
16
16
|
end
|
@@ -10,9 +10,9 @@ class HTML5ValidatorTests < Test::Unit::TestCase
|
|
10
10
|
|
11
11
|
def test_getting_request_data
|
12
12
|
VCR.use_cassette('html5_getting_request_data') do
|
13
|
-
r = @v.validate_uri('https://
|
13
|
+
r = @v.validate_uri('https://w3c-validators.github.io/w3c_validators/valid_html5.html')
|
14
14
|
assert_equal :html5, r.doctype
|
15
|
-
assert_equal 'https://
|
15
|
+
assert_equal 'https://w3c-validators.github.io/w3c_validators/valid_html5.html', r.uri
|
16
16
|
assert_no_errors r
|
17
17
|
assert_no_warnings r
|
18
18
|
assert r.is_valid?
|
@@ -21,7 +21,7 @@ class HTML5ValidatorTests < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
def test_validating_uri
|
23
23
|
VCR.use_cassette('html5_validating_uri') do
|
24
|
-
r = @v.validate_uri('https://
|
24
|
+
r = @v.validate_uri('https://w3c-validators.github.io/w3c_validators/invalid_html5.html')
|
25
25
|
assert_errors r, 2
|
26
26
|
assert_no_warnings r
|
27
27
|
assert !r.is_valid?
|
@@ -29,16 +29,16 @@ class HTML5ValidatorTests < Test::Unit::TestCase
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def test_validating_file
|
32
|
-
omit('Pending, broken')
|
33
32
|
VCR.use_cassette('html5_validating_file') do
|
34
33
|
file = File.dirname(__FILE__) + '/fixtures/invalid_html5.html'
|
35
34
|
r = @v.validate_file(file)
|
36
|
-
assert_errors r,
|
35
|
+
assert_errors r, 2
|
36
|
+
assert_no_warnings r
|
37
|
+
assert !r.is_valid?
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
40
41
|
def test_validating_text
|
41
|
-
omit('Pending, broken')
|
42
42
|
VCR.use_cassette('html5_validating_text') do
|
43
43
|
valid_fragment = <<-EOV
|
44
44
|
<!DOCTYPE html>
|
@@ -59,16 +59,30 @@ class HTML5ValidatorTests < Test::Unit::TestCase
|
|
59
59
|
EOV
|
60
60
|
|
61
61
|
r = @v.validate_text(valid_fragment)
|
62
|
-
assert_errors r,
|
62
|
+
assert_errors r, 2
|
63
|
+
assert_no_warnings r
|
64
|
+
assert !r.is_valid?
|
63
65
|
end
|
64
66
|
end
|
65
67
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
def test_validating_text_via_file
|
69
|
+
VCR.use_cassette('html5_validating_text_via_file') do
|
70
|
+
fh = File.new(File.dirname(__FILE__) + '/fixtures/invalid_html5.html', 'r+')
|
71
|
+
r = @v.validate_file(fh)
|
72
|
+
fh.close
|
73
|
+
assert_errors r, 2
|
74
|
+
assert_no_warnings r
|
75
|
+
assert !r.is_valid?
|
76
|
+
# check content of first error
|
77
|
+
assert_equal r.errors[0].line, 15
|
78
|
+
assert_equal r.errors[0].col, 3
|
79
|
+
assert r.errors[0].message =~ /unclosed elements/
|
80
|
+
# check content of second error
|
81
|
+
assert_equal r.errors[1].line, 10
|
82
|
+
assert_equal r.errors[1].col, 5
|
83
|
+
assert r.errors[1].message =~ /Unclosed element “section”/
|
84
|
+
end
|
85
|
+
end
|
72
86
|
|
73
87
|
|
74
88
|
end
|
@@ -11,7 +11,7 @@ class MarkupValidatorTests < Test::Unit::TestCase
|
|
11
11
|
def test_overriding_doctype
|
12
12
|
VCR.use_cassette('markup_overriding_doctype') do
|
13
13
|
@v.set_doctype!(:html32, false)
|
14
|
-
r = @v.validate_uri('https://
|
14
|
+
r = @v.validate_uri('https://w3c-validators.github.io/w3c_validators/invalid_markup.html')
|
15
15
|
assert_equal '-//W3C//DTD HTML 3.2 Final//EN', r.doctype
|
16
16
|
end
|
17
17
|
end
|
@@ -19,7 +19,7 @@ class MarkupValidatorTests < Test::Unit::TestCase
|
|
19
19
|
def test_overriding_doctype_for_fallback_only
|
20
20
|
VCR.use_cassette('markup_overriding_doctype_for_fallback_only') do
|
21
21
|
@v.set_doctype!(:html32, true)
|
22
|
-
r = @v.validate_uri('https://
|
22
|
+
r = @v.validate_uri('https://w3c-validators.github.io/w3c_validators/invalid_markup_1.html')
|
23
23
|
assert_not_equal '-//W3C//DTD HTML 3.2 Final//EN', r.doctype
|
24
24
|
end
|
25
25
|
end
|
@@ -27,7 +27,7 @@ class MarkupValidatorTests < Test::Unit::TestCase
|
|
27
27
|
def test_overriding_charset
|
28
28
|
VCR.use_cassette('markup_overriding_charset') do
|
29
29
|
@v.set_charset!(:utf_16, false)
|
30
|
-
r = @v.validate_uri('https://
|
30
|
+
r = @v.validate_uri('https://w3c-validators.github.io/w3c_validators/invalid_markup_2.html')
|
31
31
|
assert_equal 'utf-16', r.charset
|
32
32
|
end
|
33
33
|
end
|
@@ -35,21 +35,21 @@ class MarkupValidatorTests < Test::Unit::TestCase
|
|
35
35
|
def test_overriding_charset_for_fallback_only
|
36
36
|
VCR.use_cassette('markup_overriding_charset_for_fallback_only') do
|
37
37
|
@v.set_doctype!(:utf_16, true)
|
38
|
-
r = @v.validate_uri('https://
|
38
|
+
r = @v.validate_uri('https://w3c-validators.github.io/w3c_validators/markup_overriding_charset_for_fallback_only.html')
|
39
39
|
assert_not_equal 'utf-16', r.charset
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
def test_validating_uri_with_head_request
|
44
44
|
VCR.use_cassette('markup_validating_uri_with_head_request') do
|
45
|
-
r = @v.validate_uri_quickly('https://
|
45
|
+
r = @v.validate_uri_quickly('https://w3c-validators.github.io/w3c_validators/invalid_markup_4.html')
|
46
46
|
assert_errors r, 1
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_validating_uri_with_soap
|
51
51
|
VCR.use_cassette('markup_validating_uri_with_soap') do
|
52
|
-
r = @v.validate_uri('https://
|
52
|
+
r = @v.validate_uri('https://w3c-validators.github.io/w3c_validators/invalid_markup_5.html')
|
53
53
|
assert_errors r, 1
|
54
54
|
assert_no_warnings r
|
55
55
|
end
|
@@ -58,7 +58,7 @@ class MarkupValidatorTests < Test::Unit::TestCase
|
|
58
58
|
def test_debugging_uri
|
59
59
|
VCR.use_cassette('markup_debugging_uri') do
|
60
60
|
@v.set_debug!
|
61
|
-
r = @v.validate_uri('https://
|
61
|
+
r = @v.validate_uri('https://w3c-validators.github.io/w3c_validators/invalid_markup_6.html')
|
62
62
|
assert r.debug_messages.length > 0
|
63
63
|
end
|
64
64
|
end
|
@@ -103,7 +103,7 @@ class MarkupValidatorTests < Test::Unit::TestCase
|
|
103
103
|
VCR.use_cassette('markup_validator_abort') do
|
104
104
|
@v.set_debug!
|
105
105
|
assert_nothing_raised do
|
106
|
-
r = @v.validate_uri('https://
|
106
|
+
r = @v.validate_uri('https://w3c-validators.github.io/w3c_validators/invalid_encoding.html')
|
107
107
|
assert !r.is_valid?
|
108
108
|
assert_errors r, 1
|
109
109
|
assert_no_warnings r
|
@@ -113,7 +113,7 @@ class MarkupValidatorTests < Test::Unit::TestCase
|
|
113
113
|
|
114
114
|
def test_validator_contains_details_of_error_conditions
|
115
115
|
VCR.use_cassette('markup_validator_contains_details_of_error_conditions') do
|
116
|
-
r = @v.validate_uri('https://
|
116
|
+
r = @v.validate_uri('https://w3c-validators.github.io/w3c_validators/invalid_markup_7.html')
|
117
117
|
assert_not_nil r.errors[0].col
|
118
118
|
assert_not_nil r.errors[0].line
|
119
119
|
assert_not_nil r.errors[0].message
|
data/test/test_proxy.rb
CHANGED
@@ -24,7 +24,7 @@ class ProxyTests < Test::Unit::TestCase
|
|
24
24
|
def test_validating_uri_with_head_request
|
25
25
|
omit("Pending, to prevent w3.org abuse")
|
26
26
|
VCR.use_cassette('markup_overriding_doctype') do
|
27
|
-
r = @v.validate_uri_quickly('https://
|
27
|
+
r = @v.validate_uri_quickly('https://w3c-validators.github.io/w3c_validators/invalid_markup_8.html')
|
28
28
|
assert_errors r, 1
|
29
29
|
end
|
30
30
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
printUsage() {
|
4
|
+
echo "Usage: $0 <url or @file_path>"
|
5
|
+
}
|
6
|
+
|
7
|
+
[ $# -ne 1 ] && printUsage && exit 1
|
8
|
+
|
9
|
+
in_file="$1"
|
10
|
+
|
11
|
+
curl -H "Content-Type: text/html; charset=utf-8" --data-binary "${in_file}" https://validator.w3.org/nu/?out=json | sed -e 's/,/\n/g'
|
12
|
+
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: w3c_validators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Dunae
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: vcr
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: webmock
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ! '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: test-unit
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ! '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ! '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
description:
|
@@ -100,11 +100,10 @@ executables: []
|
|
100
100
|
extensions: []
|
101
101
|
extra_rdoc_files: []
|
102
102
|
files:
|
103
|
-
-
|
104
|
-
-
|
103
|
+
- .gitignore
|
104
|
+
- .travis.yml
|
105
105
|
- CHANGELOG
|
106
106
|
- Gemfile
|
107
|
-
- Gemfile.lock
|
108
107
|
- LICENSE
|
109
108
|
- README.md
|
110
109
|
- Rakefile
|
@@ -145,6 +144,9 @@ files:
|
|
145
144
|
- test/http_recording/feed_validating_text_via_file.yml
|
146
145
|
- test/http_recording/feed_validating_uri_with_soap.yml
|
147
146
|
- test/http_recording/html5_getting_request_data.yml
|
147
|
+
- test/http_recording/html5_validating_file.yml
|
148
|
+
- test/http_recording/html5_validating_text.yml
|
149
|
+
- test/http_recording/html5_validating_text_via_file.yml
|
148
150
|
- test/http_recording/html5_validating_uri.yml
|
149
151
|
- test/http_recording/markup_debugging_uri.yml
|
150
152
|
- test/http_recording/markup_overriding_charset.yml
|
@@ -158,6 +160,7 @@ files:
|
|
158
160
|
- test/http_recording/markup_validating_uri_with_soap.yml
|
159
161
|
- test/http_recording/markup_validator_abort.yml
|
160
162
|
- test/http_recording/markup_validator_contains_details_of_error_conditions.yml
|
163
|
+
- test/http_recording/markup_validator_html5_redirect.yml
|
161
164
|
- test/test_css_validator.rb
|
162
165
|
- test/test_exceptions.rb
|
163
166
|
- test/test_feed_validator.rb
|
@@ -165,6 +168,7 @@ files:
|
|
165
168
|
- test/test_html5_validator.rb
|
166
169
|
- test/test_markup_validator.rb
|
167
170
|
- test/test_proxy.rb
|
171
|
+
- test/tools/curl_nu.sh
|
168
172
|
- w3c_validators.gemspec
|
169
173
|
homepage: https://github.com/w3c-validators/w3c_validators
|
170
174
|
licenses: []
|
@@ -175,12 +179,12 @@ require_paths:
|
|
175
179
|
- lib
|
176
180
|
required_ruby_version: !ruby/object:Gem::Requirement
|
177
181
|
requirements:
|
178
|
-
- -
|
182
|
+
- - ~>
|
179
183
|
- !ruby/object:Gem::Version
|
180
184
|
version: '2.0'
|
181
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
186
|
requirements:
|
183
|
-
- -
|
187
|
+
- - ! '>='
|
184
188
|
- !ruby/object:Gem::Version
|
185
189
|
version: '0'
|
186
190
|
requirements: []
|
data/Gemfile.lock
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
w3c_validators (1.3)
|
5
|
-
json (~> 2.0)
|
6
|
-
nokogiri (~> 1.6)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
addressable (2.5.0)
|
12
|
-
public_suffix (~> 2.0, >= 2.0.2)
|
13
|
-
crack (0.4.3)
|
14
|
-
safe_yaml (~> 1.0.0)
|
15
|
-
hashdiff (0.3.1)
|
16
|
-
json (2.0.2)
|
17
|
-
mini_portile2 (2.1.0)
|
18
|
-
nokogiri (1.6.8.1)
|
19
|
-
mini_portile2 (~> 2.1.0)
|
20
|
-
power_assert (0.4.1)
|
21
|
-
public_suffix (2.0.4)
|
22
|
-
rake (11.3.0)
|
23
|
-
safe_yaml (1.0.4)
|
24
|
-
test-unit (3.2.3)
|
25
|
-
power_assert
|
26
|
-
vcr (3.0.3)
|
27
|
-
webmock (2.1.0)
|
28
|
-
addressable (>= 2.3.6)
|
29
|
-
crack (>= 0.3.2)
|
30
|
-
hashdiff
|
31
|
-
|
32
|
-
PLATFORMS
|
33
|
-
ruby
|
34
|
-
|
35
|
-
DEPENDENCIES
|
36
|
-
rake
|
37
|
-
test-unit
|
38
|
-
vcr
|
39
|
-
w3c_validators!
|
40
|
-
webmock
|
41
|
-
|
42
|
-
BUNDLED WITH
|
43
|
-
1.13.6
|