rspec_junit_formatter 0.3.0.pre3 → 0.3.0.pre4

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
  SHA1:
3
- metadata.gz: b7f7f33383e98b42d35551aa32136a34fa25db1f
4
- data.tar.gz: acb6a58605023e936b8decc37d92e77e151bf7c2
3
+ metadata.gz: 3eb5f0c15526709a1aef2fea35ce933a11045ec7
4
+ data.tar.gz: 13b8780f9599c9638e835898f9fe782f697504b0
5
5
  SHA512:
6
- metadata.gz: a57faf141507f04c7587dd26a87c1dfae68cb8892536ff5c48f32a083d32b5af1900cba597029ae368364e2cd0f08353ecbcbd7fc6f2be532b386eb0a58a7767
7
- data.tar.gz: e18c1259ca9fff69213ffd2cebed9758f239b211e84a7f7ec1201209791f0cf4bfffad0f9ee9a9507ff20f3ffa02b59f3e7a8459ffbf90898515105218daebed
6
+ metadata.gz: 9e38320e1ec585d37c36ca6df2671c3294d3732cadb6058252e47843b2da85ff1d5d164a2280ccab6c5c84516f0765f568612c20f944ae487583e4ff09cb4109
7
+ data.tar.gz: b3cf45e4adaac3b06cb28281d195397929808950ab46c5ffc5c78377c9ebe8ef452f52b310c58f908f54216b10f2a620ce7539ff17311eaaaa84c918163d19f1
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -70,39 +70,53 @@ private
70
70
  output << %{</testcase>\n}
71
71
  end
72
72
 
73
- # Based on valid characters allowed in XML unescaped, with restricted and
74
- # discouraged characters removed
75
- #
76
- # See https://www.w3.org/TR/xml/#dt-chardata
77
- ESCAPE_REGEXP = Regexp.new(
73
+ # Inversion of character range from https://www.w3.org/TR/xml/#charsets
74
+ ILLEGAL_REGEXP = Regexp.new(
78
75
  "[^" <<
79
76
  "\u{9}" << # => \t
80
77
  "\u{a}" << # =>\n
81
78
  "\u{d}" << # => \r
82
- "\u{20}-\u{21}" <<
83
- # "\u{22}" << # => "
84
- "\u{23}-\u{25}" <<
85
- # "\u{26}" << # => &
86
- # "\u{27}" << # => '
79
+ "\u{20}-\u{d7ff}" <<
87
80
  "\u{28}-\u{3b}" <<
88
- # "\u{3c}" << # => <
89
81
  "\u{3d}" <<
90
- # "\u{3e}" << # => >
91
- "\u{3f}-\u{7e}" <<
92
- # "\u{7f}-\u{84}" << # discouraged control characters
93
- "\u{85}" <<
94
- # "\u{86}-\u{9f}" << # discouraged control characters
95
- "\u{a0}-\u{d7ff}" <<
96
- "\u{e000}-\u{ffcf}" <<
97
- # "\u{ffd0}-\u{fdef}" <<
98
- "\u{fdf0}-\u{fffd}" <<
99
- # things get murky from here, just escape anything with a higher codepoint
100
- # "\u{10000}-\u{10ffff}" <<
82
+ "\u{e000}-\u{fffd}" <<
83
+ "\u{10000}-\u{10ffff}" <<
84
+ "]"
85
+ )
86
+
87
+ # Discouraged characters from https://www.w3.org/TR/xml/#charsets
88
+ # Plus special characters with well-known entity replacements
89
+ ESCAPE_REGEXP = Regexp.new(
90
+ "[" <<
91
+ "\u{22}" << # => "
92
+ "\u{26}" << # => &
93
+ "\u{27}" << # => '
94
+ "\u{3c}" << # => <
95
+ "\u{3e}" << # => >
96
+ "\u{7f}-\u{84}" <<
97
+ "\u{86}-\u{9f}" <<
98
+ "\u{fdd0}-\u{fdef}" <<
99
+ "\u{1fffe}-\u{1ffff}" <<
100
+ "\u{2fffe}-\u{2ffff}" <<
101
+ "\u{3fffe}-\u{3ffff}" <<
102
+ "\u{4fffe}-\u{4ffff}" <<
103
+ "\u{5fffe}-\u{5ffff}" <<
104
+ "\u{6fffe}-\u{6ffff}" <<
105
+ "\u{7fffe}-\u{7ffff}" <<
106
+ "\u{8fffe}-\u{8ffff}" <<
107
+ "\u{9fffe}-\u{9ffff}" <<
108
+ "\u{afffe}-\u{affff}" <<
109
+ "\u{bfffe}-\u{bffff}" <<
110
+ "\u{cfffe}-\u{cffff}" <<
111
+ "\u{dfffe}-\u{dffff}" <<
112
+ "\u{efffe}-\u{effff}" <<
113
+ "\u{ffffe}-\u{fffff}" <<
114
+ "\u{10fffe}-\u{10ffff}" <<
101
115
  "]"
102
116
  )
103
117
 
104
118
  # Translate well-known entities, or use generic unicode hex entity
105
- ESCAPE_ENTITY = Hash.new { |_, c| "&#x#{c.ord.to_s(16)};".freeze }.update(
119
+ ESCAPE_REPLACEMENTS = Hash.new { |_, c| "&#x#{c.ord.to_s(16)};".freeze }.update(
106
120
  ?" => "&quot;".freeze,
107
121
  ?& => "&amp;".freeze,
108
122
  ?' => "&apos;".freeze,
@@ -111,9 +125,8 @@ private
111
125
  ).freeze
112
126
 
113
127
  def escape(text)
114
- # Make sure it's utf-8 (this will throw errors for bad output, but that
115
- # seems okay) and replace invalid xml characters with entities
116
- text.to_s.encode(Encoding::UTF_8).gsub(ESCAPE_REGEXP, ESCAPE_ENTITY)
128
+ # Make sure it's utf-8, omit illegal characters, and replace special and discouraged characters with entities
129
+ text.to_s.encode(Encoding::UTF_8).gsub(ILLEGAL_REGEXP, "").gsub(ESCAPE_REGEXP, ESCAPE_REPLACEMENTS)
117
130
  end
118
131
  end
119
132
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_junit_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.pre3
4
+ version: 0.3.0.pre4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Cochran
@@ -28,7 +28,7 @@ cert_chain:
28
28
  bn56+Lu22lsUMYD62lUEdAPyYn1/JLPfq47UEuV1p5gy/f++aTxknsAYE/z/bfmO
29
29
  EkIxoeESVQ0Kqhp754GWYv3Sfmtyk8UbGo5XCZHzvC6h2G7mplPzh6o+Edw=
30
30
  -----END CERTIFICATE-----
31
- date: 2017-06-08 00:00:00.000000000 Z
31
+ date: 2017-06-14 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rspec-core
metadata.gz.sig CHANGED
Binary file