rspec_junit_formatter_bitbucket 0.2.0.pre.183 → 0.2.0.pre.184
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 732405ac58b598dd568c29384523d436c64234955b87d0aa98e5ae040bd50718
|
4
|
+
data.tar.gz: 04e5ccd1ebe946bc862b8e003a72d50f7f1fe3805c290534bdd25ae6cbae20cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3dd286fae44f56c7d91d29791bfe9b6e6dd7ab49a19cc64a7028147e6801034867157616c504d9c30be3fb782e6d3632419d4bb8b5fafc3ea80d28ff279a568
|
7
|
+
data.tar.gz: 19d24e27b4c825ca0106b101b972738f2cfff6d368c872986b8f632101922405fced8f0b599668c0becc121b6d5407926ae9726d65f980324d8d9673926c75c4
|
@@ -7,7 +7,6 @@ module RspecJunitFormatterBitbucket
|
|
7
7
|
module Format
|
8
8
|
# Inversion of character range from https://www.w3.org/TR/xml/#charsets
|
9
9
|
ILLEGAL_REGEXP = Regexp.new(
|
10
|
-
=begin
|
11
10
|
'\[\^' \
|
12
11
|
'\u{9}' \
|
13
12
|
'\u{a}' \
|
@@ -16,20 +15,10 @@ module RspecJunitFormatterBitbucket
|
|
16
15
|
'\u{e000}-\u{fffd}' \
|
17
16
|
'\u{10000}-\u{10ffff}' \
|
18
17
|
'\]'
|
19
|
-
=end
|
20
|
-
"[^" <<
|
21
|
-
"\u{9}" << # => \t
|
22
|
-
"\u{a}" << # => \n
|
23
|
-
"\u{d}" << # => \r
|
24
|
-
"\u{20}-\u{d7ff}" <<
|
25
|
-
"\u{e000}-\u{fffd}" <<
|
26
|
-
"\u{10000}-\u{10ffff}" <<
|
27
|
-
"]"
|
28
18
|
)
|
29
19
|
|
30
20
|
# Replace illegals with a Ruby-like escape
|
31
21
|
ILLEGAL_REPLACEMENT = Hash.new do |_, c|
|
32
|
-
=begin
|
33
22
|
x = c.ord
|
34
23
|
if x <= 0xff
|
35
24
|
'\\x%02X'.freeze % x
|
@@ -38,36 +27,18 @@ module RspecJunitFormatterBitbucket
|
|
38
27
|
else
|
39
28
|
'\\u{%<X>}'.freeze % x
|
40
29
|
end.freeze
|
41
|
-
=end
|
42
|
-
x = c.ord
|
43
|
-
if x <= 0xff
|
44
|
-
"\\x%02X".freeze % x
|
45
|
-
elsif x <= 0xffff
|
46
|
-
"\\u%04X".freeze % x
|
47
|
-
else
|
48
|
-
"\\u{%X}".freeze % x
|
49
|
-
end.freeze
|
50
30
|
end.update(
|
51
|
-
=begin
|
52
31
|
"\0".freeze => '\\0'.freeze,
|
53
32
|
"\a".freeze => '\\a'.freeze,
|
54
33
|
"\b".freeze => '\\b'.freeze,
|
55
34
|
"\f".freeze => '\\f'.freeze,
|
56
35
|
"\v".freeze => '\\v'.freeze,
|
57
36
|
"\e".freeze => '\\e'.freeze
|
58
|
-
=end
|
59
|
-
"\0".freeze => "\\0".freeze,
|
60
|
-
"\a".freeze => "\\a".freeze,
|
61
|
-
"\b".freeze => "\\b".freeze,
|
62
|
-
"\f".freeze => "\\f".freeze,
|
63
|
-
"\v".freeze => "\\v".freeze,
|
64
|
-
"\e".freeze => "\\e".freeze,
|
65
37
|
).freeze
|
66
38
|
|
67
39
|
# Discouraged characters from https://www.w3.org/TR/xml/#charsets
|
68
40
|
# Plus special characters with well-known entity replacements
|
69
41
|
DISCOURAGED_REGEXP = Regexp.new(
|
70
|
-
=begin
|
71
42
|
'[' \
|
72
43
|
'\u{22}' \
|
73
44
|
'\u{26}' \
|
@@ -94,59 +65,24 @@ module RspecJunitFormatterBitbucket
|
|
94
65
|
'\u{ffffe}-\u{fffff}' \
|
95
66
|
'\u{10fffe}-\u{10ffff}' \
|
96
67
|
']'
|
97
|
-
=end
|
98
|
-
"[" <<
|
99
|
-
"\u{22}" << # => "
|
100
|
-
"\u{26}" << # => &
|
101
|
-
"\u{27}" << # => '
|
102
|
-
"\u{3c}" << # => <
|
103
|
-
"\u{3e}" << # => >
|
104
|
-
"\u{7f}-\u{84}" <<
|
105
|
-
"\u{86}-\u{9f}" <<
|
106
|
-
"\u{fdd0}-\u{fdef}" <<
|
107
|
-
"\u{1fffe}-\u{1ffff}" <<
|
108
|
-
"\u{2fffe}-\u{2ffff}" <<
|
109
|
-
"\u{3fffe}-\u{3ffff}" <<
|
110
|
-
"\u{4fffe}-\u{4ffff}" <<
|
111
|
-
"\u{5fffe}-\u{5ffff}" <<
|
112
|
-
"\u{6fffe}-\u{6ffff}" <<
|
113
|
-
"\u{7fffe}-\u{7ffff}" <<
|
114
|
-
"\u{8fffe}-\u{8ffff}" <<
|
115
|
-
"\u{9fffe}-\u{9ffff}" <<
|
116
|
-
"\u{afffe}-\u{affff}" <<
|
117
|
-
"\u{bfffe}-\u{bffff}" <<
|
118
|
-
"\u{cfffe}-\u{cffff}" <<
|
119
|
-
"\u{dfffe}-\u{dffff}" <<
|
120
|
-
"\u{efffe}-\u{effff}" <<
|
121
|
-
"\u{ffffe}-\u{fffff}" <<
|
122
|
-
"\u{10fffe}-\u{10ffff}" <<
|
123
|
-
"]"
|
124
68
|
)
|
125
69
|
|
126
70
|
# Translate well-known entities, or use generic unicode hex entity
|
127
71
|
DISCOURAGED_REPLACEMENTS = Hash.new do |_, c|
|
128
72
|
"&#x#{c.ord.to_s(16)};".freeze
|
129
|
-
# "&#x#{c.ord.to_s(16)};".freeze
|
130
73
|
end.update(
|
131
|
-
=begin
|
132
74
|
'"'.freeze => '"'.freeze,
|
133
75
|
'&'.freeze => '&'.freeze,
|
134
76
|
"'".freeze => '''.freeze,
|
135
77
|
'<'.freeze => '<'.freeze,
|
136
78
|
'>'.freeze => '>'.freeze
|
137
|
-
=end
|
138
|
-
?".freeze => """.freeze,
|
139
|
-
?&.freeze => "&".freeze,
|
140
|
-
?'.freeze => "'".freeze,
|
141
|
-
?<.freeze => "<".freeze,
|
142
|
-
?>.freeze => ">".freeze,
|
143
79
|
).freeze
|
144
80
|
|
145
81
|
def self.escape(text)
|
146
82
|
text.to_s
|
147
83
|
.encode(Encoding::UTF_8)
|
148
|
-
|
149
|
-
|
84
|
+
.gsub(ILLEGAL_REGEXP, ILLEGAL_REPLACEMENT)
|
85
|
+
.gsub(DISCOURAGED_REGEXP, DISCOURAGED_REPLACEMENTS)
|
150
86
|
end
|
151
87
|
|
152
88
|
# rubocop:disable Metrics/LineLength
|
@@ -11,12 +11,12 @@ module RspecJunitFormatterBitbucket
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def dump
|
14
|
-
@output << %(<
|
14
|
+
@output << %(<testsuite #{rm_char_nw_line(testsuite_attr)}>\n)
|
15
15
|
@output << %(<properties>\n)
|
16
16
|
@output << %(<property #{rm_char_nw_line(property_attr)}/>\n)
|
17
17
|
@output << %(</properties>\n)
|
18
18
|
dump_examples
|
19
|
-
@output << %(</
|
19
|
+
@output << %(</testsuite>\n)
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
@@ -73,10 +73,10 @@ module RspecJunitFormatterBitbucket
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def dump_example(example)
|
76
|
-
@output << %(<
|
76
|
+
@output << %(<testcase #{rm_char_nw_line(testcase_attr(example))}>)
|
77
77
|
yield if block_given?
|
78
78
|
dump_output(example)
|
79
|
-
@output << %(</
|
79
|
+
@output << %(</testcase>\n)
|
80
80
|
end
|
81
81
|
|
82
82
|
def testcase_attr(example)
|