xmp2assert 8 → 9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -0
- data/lib/xmp2assert/assertions.rb +1 -1
- data/lib/xmp2assert/converter.rb +9 -2
- data/lib/xmp2assert/parser.rb +1 -1
- data/lib/xmp2assert/version.rb +1 -1
- data/lib/xmp2assert/xmp2rexp.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ae8c02650ca81c693170d40a67874a8622a3601
|
4
|
+
data.tar.gz: 4a9dbbc7a6138af3430254152e545e605a742177
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bf2ea17492c7442179e9c6fb2ea43e0975a99e506d7c4bee1dfacf934a224da6e785fa391355d1ebe88f66d6a576406512ad77c9e2b29bbe9a3de1b70f30cf4
|
7
|
+
data.tar.gz: 1ecb3f324149b5cccc53ceb0a8bc5e404c6a76b8b4863f9736430523779c2d1ce6db425a7e2975b80cef5ccd6920626aeb095dfcaa8118bf5d4fc04d6c43ca5f
|
data/.rubocop.yml
CHANGED
@@ -78,6 +78,9 @@ Style/ClassAndModuleChildren:
|
|
78
78
|
Style/ClassVars:
|
79
79
|
Enabled: false
|
80
80
|
|
81
|
+
Style/ConstantName:
|
82
|
+
Enabled: false
|
83
|
+
|
81
84
|
Style/ElseAlignment:
|
82
85
|
Enabled: false
|
83
86
|
|
@@ -129,9 +132,15 @@ Style/MultilineIfThen:
|
|
129
132
|
Style/MultilineMethodCallIndentation:
|
130
133
|
Enabled: false
|
131
134
|
|
135
|
+
Style/MutableConstant:
|
136
|
+
Enabled: false
|
137
|
+
|
132
138
|
Style/Not:
|
133
139
|
Enabled: false
|
134
140
|
|
141
|
+
Style/NumericLiterals:
|
142
|
+
Enabled: false
|
143
|
+
|
135
144
|
Style/ParallelAssignment:
|
136
145
|
Enabled: false
|
137
146
|
|
@@ -29,6 +29,7 @@ require 'test/unit/assertion-failed-error'
|
|
29
29
|
require_relative 'namespace'
|
30
30
|
require_relative 'quasifile'
|
31
31
|
require_relative 'xmp2rexp'
|
32
|
+
require_relative 'converter'
|
32
33
|
require_relative 'renderer'
|
33
34
|
require_relative 'spawn'
|
34
35
|
|
@@ -46,7 +47,6 @@ module XMP2Assert::Assertions
|
|
46
47
|
#
|
47
48
|
# @param script [Quasifile] a ruby script.
|
48
49
|
# @param message [String] extra failure message.
|
49
|
-
# @param rubyopts [Array<String>] extra opts to pass to ruby process.
|
50
50
|
# @param stdin_data [String] extra stdin to pass to ruby process.
|
51
51
|
# @param opts [Hash] extra opts to pass to Kernel.spawn.
|
52
52
|
def assert_xmp script, message = nil, stdin_data: '', **opts
|
data/lib/xmp2assert/converter.rb
CHANGED
@@ -339,9 +339,16 @@ class XMP2Assert::Converter
|
|
339
339
|
xmp = tok
|
340
340
|
end
|
341
341
|
when :comment then
|
342
|
+
re = /^#\s*/
|
342
343
|
if xmp then
|
343
|
-
|
344
|
-
tok.
|
344
|
+
space = re.match(tok.to_s).to_s.length
|
345
|
+
if xmp.__COLUMN__ + 5 <= tok.__COLUMN__ + space # 5 is `# => `
|
346
|
+
xmp.to_s.concat tok.to_s.sub(re, ' ')
|
347
|
+
tok.yylval = "#\n"
|
348
|
+
else
|
349
|
+
# dedent
|
350
|
+
xmp = nil
|
351
|
+
end
|
345
352
|
else
|
346
353
|
xmp = nil
|
347
354
|
end
|
data/lib/xmp2assert/parser.rb
CHANGED
data/lib/xmp2assert/version.rb
CHANGED
data/lib/xmp2assert/xmp2rexp.rb
CHANGED
@@ -48,7 +48,7 @@ module XMP2Assert::XMP2Rexp
|
|
48
48
|
# :NOTE: we are editing regular expressions using regular expressions. In
|
49
49
|
# order to hack this method you must be a seasoned regular expression
|
50
50
|
# craftsperson who can count backslashes at ease.
|
51
|
-
src = Regexp.escape xmp.
|
51
|
+
src = Regexp.escape xmp.strip
|
52
52
|
src.gsub!(/([^\\])(\\n|\\ )+/, '\\1\s+')
|
53
53
|
src.gsub!(/(#<[\w:]+?:)0x[0-9a-f]+/, '\\10x[0-9a-f]+')
|
54
54
|
src.gsub!(/\\\.rb:\d+/, '\\.rb:\d+')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xmp2assert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '9'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Urabe, Shyouhei
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|