rspec_junit_formatter 0.3.0.pre4 → 0.3.0.pre5

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: 3eb5f0c15526709a1aef2fea35ce933a11045ec7
4
- data.tar.gz: 13b8780f9599c9638e835898f9fe782f697504b0
3
+ metadata.gz: ca1245d6a6ab72821ed12421f83f5d19e160e150
4
+ data.tar.gz: 8adb046de7cfa63694143046bedbcff68e496637
5
5
  SHA512:
6
- metadata.gz: 9e38320e1ec585d37c36ca6df2671c3294d3732cadb6058252e47843b2da85ff1d5d164a2280ccab6c5c84516f0765f568612c20f944ae487583e4ff09cb4109
7
- data.tar.gz: b3cf45e4adaac3b06cb28281d195397929808950ab46c5ffc5c78377c9ebe8ef452f52b310c58f908f54216b10f2a620ce7539ff17311eaaaa84c918163d19f1
6
+ metadata.gz: 27bf67f53a85bb7a352d0b2885e9a96f169cd28be692870a24848f04e1572ef3b7c0d0a53928b2a7ec8a709b79bbbc20c79c41090003579cfb2490d9c202a57b
7
+ data.tar.gz: bb2cdff147bacaa458925108244595bae509b1d26398a20b741d6057720d9759f479e8cefedff4e7bb9e80210126efa43e8f269bed5d3b8b1d4632eb1f953361
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -84,9 +84,28 @@ private
84
84
  "]"
85
85
  )
86
86
 
87
+ # Replace illegals with a Ruby-like escape
88
+ ILLEGAL_REPLACEMENT = Hash.new { |_, c|
89
+ x = c.ord
90
+ if x <= 0xff
91
+ "\\x%02X".freeze % x
92
+ elsif x <= 0xffff
93
+ "\\u%04X".freeze % x
94
+ else
95
+ "\\u{%X}".freeze % x
96
+ end.freeze
97
+ }.update(
98
+ "\0".freeze => "\\0".freeze,
99
+ "\a".freeze => "\\a".freeze,
100
+ "\b".freeze => "\\b".freeze,
101
+ "\f".freeze => "\\f".freeze,
102
+ "\v".freeze => "\\v".freeze,
103
+ "\e".freeze => "\\e".freeze,
104
+ ).freeze
105
+
87
106
  # Discouraged characters from https://www.w3.org/TR/xml/#charsets
88
107
  # Plus special characters with well-known entity replacements
89
- ESCAPE_REGEXP = Regexp.new(
108
+ DISCOURAGED_REGEXP = Regexp.new(
90
109
  "[" <<
91
110
  "\u{22}" << # => "
92
111
  "\u{26}" << # => &
@@ -116,17 +135,17 @@ private
116
135
  )
117
136
 
118
137
  # Translate well-known entities, or use generic unicode hex entity
119
- ESCAPE_REPLACEMENTS = Hash.new { |_, c| "&#x#{c.ord.to_s(16)};".freeze }.update(
120
- ?" => "&quot;".freeze,
121
- ?& => "&amp;".freeze,
122
- ?' => "&apos;".freeze,
123
- ?< => "&lt;".freeze,
124
- ?> => "&gt;".freeze,
138
+ DISCOURAGED_REPLACEMENTS = Hash.new { |_, c| "&#x#{c.ord.to_s(16)};".freeze }.update(
139
+ ?".freeze => "&quot;".freeze,
140
+ ?&.freeze => "&amp;".freeze,
141
+ ?'.freeze => "&apos;".freeze,
142
+ ?<.freeze => "&lt;".freeze,
143
+ ?>.freeze => "&gt;".freeze,
125
144
  ).freeze
126
145
 
127
146
  def escape(text)
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)
147
+ # Make sure it's utf-8, replace illegal characters with ruby-like escapes, and replace special and discouraged characters with entities
148
+ text.to_s.encode(Encoding::UTF_8).gsub(ILLEGAL_REGEXP, ILLEGAL_REPLACEMENT).gsub(DISCOURAGED_REGEXP, DISCOURAGED_REPLACEMENTS)
130
149
  end
131
150
  end
132
151
 
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.pre4
4
+ version: 0.3.0.pre5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Cochran
metadata.gz.sig CHANGED
Binary file