yard-doctest 0.1.9 → 0.1.10
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/features/yard-doctest.feature +10 -1
- data/lib/yard/doctest/example.rb +11 -4
- data/lib/yard/doctest/version.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: 29e48bebd491242d186f47e8e22d2a47733f3589
|
4
|
+
data.tar.gz: b0f16f022adbd8e1340b243d677e51e124c3d58f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c64f734aecad92a6e23f5ab0ebc6d50068d7a863074abf22e9689cd7d350b5483cb03a3f588ded8ce037cd88f4fe5171ff491bcd4882ab43c132a18bc58421fa
|
7
|
+
data.tar.gz: 64798db18bf07febd134ecaa32c17dc1b9bdbd7ee17a8d12e630311a3c5666fb209b907d452decca5727a0587879fedf9d4744b82160f9ccdeaff6dd74080cfe
|
data/CHANGELOG.md
CHANGED
@@ -442,9 +442,18 @@ Feature: yard doctest
|
|
442
442
|
def sum(one, two)
|
443
443
|
one + two
|
444
444
|
end
|
445
|
+
|
446
|
+
module App
|
447
|
+
# @example
|
448
|
+
# src = {foo: 'bar'}
|
449
|
+
# src[:foo] #=> 'bar'
|
450
|
+
# src[:foo] #=> 'bar'
|
451
|
+
def foo
|
452
|
+
end
|
453
|
+
end
|
445
454
|
"""
|
446
455
|
When I run `bundle exec yard doctest`
|
447
|
-
Then the output should contain "
|
456
|
+
Then the output should contain "2 runs, 4 assertions, 0 failures, 0 errors, 0 skips"
|
448
457
|
|
449
458
|
Scenario: does not share binding between examples
|
450
459
|
Given a file named "doctest_helper.rb" with:
|
data/lib/yard/doctest/example.rb
CHANGED
@@ -60,25 +60,32 @@ module YARD
|
|
60
60
|
protected
|
61
61
|
|
62
62
|
def evaluate_example(example, actual, bind)
|
63
|
-
(
|
63
|
+
evaluate(actual, bind)
|
64
64
|
rescue StandardError => error
|
65
65
|
add_filepath_to_backtrace(error, example.filepath)
|
66
66
|
raise error
|
67
67
|
end
|
68
68
|
|
69
69
|
def assert_example(example, expected, actual, bind)
|
70
|
-
assert_equal
|
70
|
+
assert_equal(evaluate_with_assertion(expected, bind),
|
71
|
+
evaluate_with_assertion(actual, bind))
|
71
72
|
rescue Minitest::Assertion => error
|
72
73
|
add_filepath_to_backtrace(error, example.filepath)
|
73
74
|
raise error
|
74
75
|
end
|
75
76
|
|
76
|
-
def
|
77
|
-
(
|
77
|
+
def evaluate_with_assertion(code, bind)
|
78
|
+
evaluate(code, bind)
|
78
79
|
rescue StandardError => error
|
79
80
|
"#<#{error.class}: #{error}>"
|
80
81
|
end
|
81
82
|
|
83
|
+
def evaluate(code, bind)
|
84
|
+
context.eval code
|
85
|
+
rescue NameError
|
86
|
+
bind ? bind.__send__(:eval, code) : raise
|
87
|
+
end
|
88
|
+
|
82
89
|
def context
|
83
90
|
@binding ||= binding
|
84
91
|
end
|
data/lib/yard/doctest/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-doctest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Rodionov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|