asciidoctor-doctest 1.5.1.2 → 1.5.2.0
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.adoc +12 -0
- data/README.adoc +2 -2
- data/lib/asciidoctor/doctest/asciidoc/examples_suite.rb +30 -7
- data/lib/asciidoctor/doctest/asciidoc_renderer.rb +4 -4
- data/lib/asciidoctor/doctest/base_example.rb +5 -5
- data/lib/asciidoctor/doctest/base_examples_suite.rb +36 -5
- data/lib/asciidoctor/doctest/generator.rb +4 -2
- data/lib/asciidoctor/doctest/generator_task.rb +4 -3
- data/lib/asciidoctor/doctest/html/example.rb +1 -1
- data/lib/asciidoctor/doctest/html/examples_suite.rb +41 -34
- data/lib/asciidoctor/doctest/html/normalizer.rb +3 -1
- data/lib/asciidoctor/doctest/minitest_diffy.rb +5 -3
- data/lib/asciidoctor/doctest/test.rb +4 -2
- data/lib/asciidoctor/doctest/version.rb +1 -1
- data/spec/asciidoc/examples_suite_spec.rb +53 -8
- data/spec/base_example_spec.rb +2 -0
- data/spec/html/examples_suite_spec.rb +12 -17
- data/spec/minitest_diffy_spec.rb +5 -3
- data/spec/shared_examples/base_examples_suite.rb +29 -1
- data/spec/spec_helper.rb +2 -0
- metadata +26 -38
- data/lib/asciidoctor/doctest/core_ext.rb +0 -64
- data/lib/asciidoctor/doctest/html/html_beautifier.rb +0 -17
- data/spec/core_ext_spec.rb +0 -67
- data/spec/support/fakefs.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17448118b205d1f1a39fb2ccde52df38b512899e
|
4
|
+
data.tar.gz: 22caa40c2925809f7931347b267639676cc9c88a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 098697a3599f989cf9b39a463182467c06ef6c2fb8dfeb9beca1510967899ad8a406368fcc392cdf16e7eef287b0d2deda3097f3692bb18207326891716fb41e
|
7
|
+
data.tar.gz: 119b67494d4af4d29eb09ddb22e1a2f189290b5bc3e095bd74a40469109c16317754d30111178e7a4b1a10eb677d9f283b9887b7b5cb7ac7a4d33ed75837c6ae
|
data/CHANGELOG.adoc
CHANGED
@@ -7,6 +7,18 @@ This document provides a high-level view of the changes introduced in DocTest by
|
|
7
7
|
For a detailed view of what has changed, refer to the {repo-uri}/commits/master[commit history] on GitHub.
|
8
8
|
|
9
9
|
|
10
|
+
== 1.5.2.0 (2015-04-04)
|
11
|
+
|
12
|
+
Improvements::
|
13
|
+
* Update https://github.com/threedaymonk/htmlbeautifier[htmlbeautifier] to 1.0.0 and remove workaround in `html/html_beautifier` [{commit-uri}/6caafb0[6caafb0]].
|
14
|
+
* Extract formatting (serialization) of example’s options into `BaseExamplesSuite#format_options` to be reusable [{commit-uri}/c4d779c[c4d779c]].
|
15
|
+
* Implement serialization of examples suite into AsciiDoc [{commit-uri}/900aab8[900aab8]].
|
16
|
+
* Replace custom core extensions, ActiveSupport and Colorize with https://github.com/jirutka/corefines[Corefines]. This also means that refinements will be used instead of global monkey-patching, when running on Ruby that supports refinements (currently MRI ≥2.1.0). [{commit-uri}/50e05c1[50e05c1], {commit-uri}/2f4a42e[2f4a42e]]
|
17
|
+
|
18
|
+
Bug fixes::
|
19
|
+
* Fix implementation of `eql?` and `hash` in BaseExample [{commit-uri}/c27615b[c27615b]].
|
20
|
+
|
21
|
+
|
10
22
|
== 1.5.1.2 (2015-01-03)
|
11
23
|
|
12
24
|
Improvements::
|
data/README.adoc
CHANGED
@@ -56,12 +56,12 @@ mkdir -p test/examples/asciidoc
|
|
56
56
|
. Add development dependency on `asciidoctor-doctest` to your gemspec:
|
57
57
|
+
|
58
58
|
[source]
|
59
|
-
s.add_development_dependency 'asciidoctor-doctest', '~> 1.5'
|
59
|
+
s.add_development_dependency 'asciidoctor-doctest', '~> 1.5.2'
|
60
60
|
+
|
61
61
|
or Gemfile if you’re not distributing the backend as a gem:
|
62
62
|
+
|
63
63
|
[source]
|
64
|
-
gem 'asciidoctor-doctest', '~> 1.5'
|
64
|
+
gem 'asciidoctor-doctest', '~> 1.5.2'
|
65
65
|
+
|
66
66
|
and run `bundle install`.
|
67
67
|
|
@@ -1,5 +1,9 @@
|
|
1
1
|
require 'asciidoctor/doctest/base_examples_suite'
|
2
|
-
require '
|
2
|
+
require 'corefines'
|
3
|
+
|
4
|
+
using Corefines::Enumerable::map_send
|
5
|
+
using Corefines::Object[:blank?, :presence]
|
6
|
+
using Corefines::String::concat!
|
3
7
|
|
4
8
|
module Asciidoctor::DocTest
|
5
9
|
module Asciidoc
|
@@ -8,8 +12,12 @@ module Asciidoctor::DocTest
|
|
8
12
|
#
|
9
13
|
# @example Format of the example's header
|
10
14
|
# // .example-name
|
11
|
-
# // Any text that is not the example's name is considered
|
15
|
+
# // Any text that is not the example's name or an option is considered
|
12
16
|
# // as a description.
|
17
|
+
# // :option_1: value 1
|
18
|
+
# // :option_2: value 1
|
19
|
+
# // :option_2: value 2
|
20
|
+
# // :boolean_option:
|
13
21
|
# The example's content in *AsciiDoc*.
|
14
22
|
#
|
15
23
|
# NOTE: The trailing new line (below this) will be removed.
|
@@ -25,20 +33,35 @@ module Asciidoctor::DocTest
|
|
25
33
|
current = create_example(nil)
|
26
34
|
|
27
35
|
input.each_line do |line|
|
28
|
-
line.chomp!
|
29
|
-
|
36
|
+
case line.chomp!
|
37
|
+
when %r{^//\s*\.([^ \n]+)}
|
30
38
|
local_name = $1
|
31
39
|
current.content.chomp!
|
32
40
|
examples << (current = create_example([group_name, local_name]))
|
33
|
-
|
34
|
-
|
41
|
+
when %r{^//\s*:([^:]+):(.*)}
|
42
|
+
current[$1.to_sym] = $2.blank? ? true : $2.strip
|
43
|
+
when %r{^//\s*(.*)\s*$}
|
44
|
+
(current.desc ||= '').concat!($1, "\n")
|
35
45
|
else
|
36
|
-
current.content.concat(line, "\n")
|
46
|
+
current.content.concat!(line, "\n")
|
37
47
|
end
|
38
48
|
end
|
39
49
|
|
40
50
|
examples
|
41
51
|
end
|
52
|
+
|
53
|
+
def serialize(examples)
|
54
|
+
Array(examples).map { |exmpl|
|
55
|
+
Array.new.push(".#{exmpl.local_name}")
|
56
|
+
.push(*exmpl.desc.lines.map(&:chomp))
|
57
|
+
.push(*format_options(exmpl.opts))
|
58
|
+
.map_send(:prepend, '// ')
|
59
|
+
.push(exmpl.content.presence)
|
60
|
+
.compact
|
61
|
+
.join("\n")
|
62
|
+
.concat("\n")
|
63
|
+
}.join("\n")
|
64
|
+
end
|
42
65
|
end
|
43
66
|
end
|
44
67
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'active_support/core_ext/array/wrap'
|
2
|
-
require 'active_support/core_ext/object/blank'
|
3
1
|
require 'asciidoctor'
|
4
2
|
require 'asciidoctor/converter/template'
|
5
|
-
require '
|
3
|
+
require 'corefines'
|
6
4
|
require 'delegate'
|
7
5
|
|
6
|
+
using Corefines::Object[:blank?, :presence]
|
7
|
+
|
8
8
|
module Asciidoctor
|
9
9
|
module DocTest
|
10
10
|
##
|
@@ -43,7 +43,7 @@ module Asciidoctor
|
|
43
43
|
@converter = converter
|
44
44
|
@converter ||= NoFallbackTemplateConverter unless template_dirs.empty? || templates_fallback
|
45
45
|
|
46
|
-
template_dirs = Array
|
46
|
+
template_dirs = Array(template_dirs).freeze
|
47
47
|
template_dirs.each do |path|
|
48
48
|
fail ArgumentError, "Templates directory '#{path}' doesn't exist!" unless Dir.exist? path
|
49
49
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
|
1
|
+
require 'corefines'
|
2
|
+
|
3
|
+
using Corefines::Object[:blank?, :deep_dup, :instance_values]
|
4
4
|
|
5
5
|
module Asciidoctor
|
6
6
|
module DocTest
|
@@ -146,12 +146,12 @@ module Asciidoctor
|
|
146
146
|
# otherwise +false+.
|
147
147
|
def eql?(other)
|
148
148
|
self.class == other.class &&
|
149
|
-
|
149
|
+
instance_values == other.instance_values
|
150
150
|
end
|
151
151
|
|
152
152
|
# :nocov:
|
153
153
|
def hash
|
154
|
-
self.class.hash ^
|
154
|
+
self.class.hash ^ instance_values.hash
|
155
155
|
end
|
156
156
|
# :nocov:
|
157
157
|
|
@@ -1,8 +1,9 @@
|
|
1
|
-
require '
|
2
|
-
require 'active_support/core_ext/array/wrap'
|
3
|
-
require 'active_support/core_ext/class/attribute'
|
1
|
+
require 'corefines'
|
4
2
|
require 'pathname'
|
5
3
|
|
4
|
+
using Corefines::Object::blank?
|
5
|
+
using Corefines::Enumerable::index_by
|
6
|
+
|
6
7
|
module Asciidoctor
|
7
8
|
module DocTest
|
8
9
|
##
|
@@ -24,7 +25,7 @@ module Asciidoctor
|
|
24
25
|
fail ArgumentError, 'file_ext must not be blank or nil' if file_ext.blank?
|
25
26
|
|
26
27
|
@file_ext = file_ext.strip.freeze
|
27
|
-
@examples_path = Array
|
28
|
+
@examples_path = Array(examples_path).freeze
|
28
29
|
@examples_cache = {}
|
29
30
|
end
|
30
31
|
|
@@ -150,7 +151,7 @@ module Asciidoctor
|
|
150
151
|
examples.group_by(&:group_name).each do |group, exmpls|
|
151
152
|
# replace cached examples with the given ones and preserve original order
|
152
153
|
updated_group = [ read_examples(group), exmpls ]
|
153
|
-
.
|
154
|
+
.map { |e| e.index_by(&:local_name) }
|
154
155
|
.reduce(:merge)
|
155
156
|
.values
|
156
157
|
|
@@ -173,6 +174,36 @@ module Asciidoctor
|
|
173
174
|
}.sort
|
174
175
|
end
|
175
176
|
|
177
|
+
protected
|
178
|
+
|
179
|
+
##
|
180
|
+
# Converts the given options into the format used in examples file.
|
181
|
+
#
|
182
|
+
# @example
|
183
|
+
# {
|
184
|
+
# option1: 'value 1',
|
185
|
+
# option2: ['value 1', 'value 2']
|
186
|
+
# option3: true
|
187
|
+
# }
|
188
|
+
# V---V---V---V---V---V---V---V---V
|
189
|
+
# [
|
190
|
+
# ':option1: value 1',
|
191
|
+
# ':option2: value 1',
|
192
|
+
# ':option2: value 2',
|
193
|
+
# ':option3:'
|
194
|
+
# ]
|
195
|
+
#
|
196
|
+
# @param opts [Hash] options
|
197
|
+
# @return [Array<String>] formatted options
|
198
|
+
#
|
199
|
+
def format_options(opts)
|
200
|
+
opts.each_with_object([]) do |(name, vals), ary|
|
201
|
+
Array(vals).each do |val|
|
202
|
+
ary << (val == true ? ":#{name}:" : ":#{name}: #{val}")
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
176
207
|
private
|
177
208
|
|
178
209
|
def read_files(file_name)
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'asciidoctor'
|
2
|
-
require '
|
2
|
+
require 'corefines'
|
3
|
+
|
4
|
+
using Corefines::String::color
|
3
5
|
|
4
6
|
module Asciidoctor
|
5
7
|
module DocTest
|
@@ -35,7 +37,7 @@ module Asciidoctor
|
|
35
37
|
next unless input.name_match? pattern
|
36
38
|
|
37
39
|
log = ->(msg, color = :default) do
|
38
|
-
log_os << " --> #{(msg % input.name).
|
40
|
+
log_os << " --> #{(msg % input.name).color(color)}\n" if log_os
|
39
41
|
end
|
40
42
|
|
41
43
|
if input.empty?
|
@@ -1,8 +1,9 @@
|
|
1
|
-
require 'active_support/core_ext/string/strip'
|
2
1
|
require 'asciidoctor/doctest/generator'
|
3
|
-
require '
|
2
|
+
require 'corefines'
|
4
3
|
require 'rake/tasklib'
|
5
4
|
|
5
|
+
using Corefines::String::unindent
|
6
|
+
|
6
7
|
module Asciidoctor
|
7
8
|
module DocTest
|
8
9
|
##
|
@@ -99,7 +100,7 @@ module Asciidoctor
|
|
99
100
|
end
|
100
101
|
|
101
102
|
def description
|
102
|
-
<<-EOS.
|
103
|
+
<<-EOS.unindent
|
103
104
|
#{title}
|
104
105
|
|
105
106
|
Options (environment variables):
|
@@ -1,11 +1,12 @@
|
|
1
|
-
require 'active_support/core_ext/array/wrap'
|
2
|
-
require 'active_support/core_ext/object/blank'
|
3
1
|
require 'asciidoctor/doctest/base_examples_suite'
|
4
|
-
require 'asciidoctor/doctest/core_ext'
|
5
2
|
require 'asciidoctor/doctest/html/example'
|
6
3
|
require 'asciidoctor/doctest/html/normalizer'
|
4
|
+
require 'corefines'
|
7
5
|
require 'nokogiri'
|
8
6
|
|
7
|
+
using Corefines::Object[:blank?, :presence, :then]
|
8
|
+
using Corefines::String::concat!
|
9
|
+
|
9
10
|
module Asciidoctor::DocTest
|
10
11
|
module HTML
|
11
12
|
##
|
@@ -13,12 +14,12 @@ module Asciidoctor::DocTest
|
|
13
14
|
#
|
14
15
|
# @example Format of the example's header
|
15
16
|
# <!-- .example-name
|
16
|
-
# Any text that is not the example's name or an option
|
17
|
-
#
|
18
|
-
# :
|
19
|
-
# :
|
20
|
-
# :
|
21
|
-
# :
|
17
|
+
# Any text that is not the example's name or an option is considered
|
18
|
+
# as a description.
|
19
|
+
# :option_1: value 1
|
20
|
+
# :option_2: value 1
|
21
|
+
# :option_2: value 2
|
22
|
+
# :boolean_option:
|
22
23
|
# -->
|
23
24
|
# <p>The example's content in <strong>HTML</strong>.</p>
|
24
25
|
#
|
@@ -46,12 +47,12 @@ module Asciidoctor::DocTest
|
|
46
47
|
elsif in_comment
|
47
48
|
if line =~ /^\s*:([^:]+):(.*)/
|
48
49
|
current[$1.to_sym] = $2.blank? ? true : $2.strip
|
49
|
-
|
50
|
+
else
|
50
51
|
desc = line.rstrip.chomp('-->').strip
|
51
|
-
(current.desc ||= '').concat(desc, "\n") unless desc.empty?
|
52
|
+
(current.desc ||= '').concat!(desc, "\n") unless desc.empty?
|
52
53
|
end
|
53
54
|
else
|
54
|
-
current.content.concat(line, "\n")
|
55
|
+
current.content.concat!(line, "\n")
|
55
56
|
end
|
56
57
|
in_comment &= !line.end_with?('-->')
|
57
58
|
end
|
@@ -60,16 +61,14 @@ module Asciidoctor::DocTest
|
|
60
61
|
end
|
61
62
|
|
62
63
|
def serialize(examples)
|
63
|
-
Array
|
64
|
-
header = [
|
64
|
+
Array(examples).map { |exmpl|
|
65
|
+
header = [
|
66
|
+
".#{exmpl.local_name}",
|
67
|
+
exmpl.desc.presence,
|
68
|
+
*format_options(exmpl.opts)
|
69
|
+
].compact
|
65
70
|
|
66
|
-
exmpl.opts.each do |name, vals|
|
67
|
-
Array.wrap(vals).each do |val|
|
68
|
-
header << (val == true ? ":#{name}:" : ":#{name}: #{val}")
|
69
|
-
end
|
70
|
-
end
|
71
71
|
header_str = header.one? ? (header.first + ' ') : (header.join("\n") + "\n")
|
72
|
-
|
73
72
|
[ "<!-- #{header_str}-->", exmpl.content.presence ].compact.join("\n") + "\n"
|
74
73
|
}.join("\n")
|
75
74
|
end
|
@@ -79,30 +78,38 @@ module Asciidoctor::DocTest
|
|
79
78
|
end
|
80
79
|
|
81
80
|
def convert_example(example, opts, renderer)
|
81
|
+
# The header & footer are excluded by default; always enable for document examples.
|
82
82
|
header_footer = !!opts[:header_footer] || example.name.start_with?('document')
|
83
83
|
|
84
|
-
|
85
|
-
html = parse_html(html, !header_footer)
|
86
|
-
|
87
|
-
# When asserting inline examples, ignore paragraph "wrapper".
|
84
|
+
# When asserting inline examples, defaults to ignore paragraph "wrapper".
|
88
85
|
includes = opts[:include] || (@paragraph_xpath if example.name.start_with? 'inline_')
|
89
86
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
87
|
+
renderer.convert(example.content, header_footer: header_footer)
|
88
|
+
.then { |s| parse_html s, !header_footer }
|
89
|
+
.then { |h| find_nodes h, includes }
|
90
|
+
.then { |h| remove_nodes h, opts[:exclude] }
|
91
|
+
.then { |h| h.normalize! }
|
92
|
+
.then { |h| HtmlBeautifier.beautify h }
|
93
|
+
.then { |h| create_example example.name, content: h, opts: opts }
|
94
|
+
end
|
95
|
+
|
96
|
+
protected
|
94
97
|
|
95
|
-
|
96
|
-
|
98
|
+
def find_nodes(html, xpaths)
|
99
|
+
Array(xpaths).reduce(html) do |htm, xpath|
|
100
|
+
# XPath returns NodeSet, but we need DocumentFragment, so convert it again.
|
101
|
+
parse_html htm.xpath(xpath).to_html
|
97
102
|
end
|
103
|
+
end
|
98
104
|
|
99
|
-
|
105
|
+
def remove_nodes(html, xpaths)
|
106
|
+
return html unless xpaths
|
100
107
|
|
101
|
-
|
108
|
+
Array(xpaths).each_with_object(html.clone) do |xpath, htm|
|
109
|
+
htm.xpath(xpath).remove
|
110
|
+
end
|
102
111
|
end
|
103
112
|
|
104
|
-
private
|
105
|
-
|
106
113
|
def parse_html(str, fragment = true)
|
107
114
|
fragment ? ::Nokogiri::HTML.fragment(str) : ::Nokogiri::HTML.parse(str)
|
108
115
|
end
|
@@ -1,6 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require 'corefines'
|
2
2
|
require 'diffy'
|
3
3
|
|
4
|
+
using Corefines::String::color
|
5
|
+
|
4
6
|
module Asciidoctor
|
5
7
|
module DocTest
|
6
8
|
##
|
@@ -59,9 +61,9 @@ module Diffy
|
|
59
61
|
when /^\\\s*No newline at end of file/
|
60
62
|
# ignore
|
61
63
|
when /^\+/
|
62
|
-
line.chomp.sub(/^\+/, 'A' + padding).red
|
64
|
+
line.chomp.sub(/^\+/, 'A' + padding).color(:red)
|
63
65
|
when /^-/
|
64
|
-
line.chomp.sub(/^\-/, 'E' + padding).green
|
66
|
+
line.chomp.sub(/^\-/, 'E' + padding).color(:green)
|
65
67
|
else
|
66
68
|
padding + line.chomp
|
67
69
|
end
|
@@ -1,10 +1,12 @@
|
|
1
|
-
require 'active_support/core_ext/object/blank'
|
2
1
|
require 'asciidoctor/doctest/asciidoc_renderer'
|
3
|
-
require 'asciidoctor/doctest/core_ext'
|
4
2
|
require 'asciidoctor/doctest/minitest_diffy'
|
5
3
|
require 'asciidoctor/doctest/asciidoc/examples_suite'
|
4
|
+
require 'corefines'
|
6
5
|
require 'minitest'
|
7
6
|
|
7
|
+
using Corefines::Object[:blank?, :presence]
|
8
|
+
using Corefines::Module::alias_class_method
|
9
|
+
|
8
10
|
module Asciidoctor
|
9
11
|
module DocTest
|
10
12
|
##
|
@@ -1,6 +1,7 @@
|
|
1
|
-
require 'active_support/core_ext/string/strip'
|
2
1
|
require 'forwardable'
|
3
2
|
|
3
|
+
using Corefines::String::unindent
|
4
|
+
|
4
5
|
describe DocTest::Asciidoc::ExamplesSuite do
|
5
6
|
extend Forwardable
|
6
7
|
|
@@ -19,18 +20,23 @@ describe DocTest::Asciidoc::ExamplesSuite do
|
|
19
20
|
end
|
20
21
|
|
21
22
|
|
22
|
-
describe '
|
23
|
+
describe 'parsing/serialization:' do
|
23
24
|
|
24
25
|
context 'one example' do
|
25
26
|
|
26
27
|
shared_examples :example do
|
27
|
-
|
28
|
+
let(:parsed) { suite.parse input, 's' }
|
29
|
+
let(:serialized) { suite.serialize output }
|
28
30
|
|
29
|
-
it {
|
31
|
+
it { expect(parsed).to have(1).items }
|
30
32
|
|
31
|
-
it 'returns an array with parsed
|
33
|
+
it 'returns an array with parsed example object' do
|
32
34
|
expect(parsed.first).to eql output
|
33
35
|
end
|
36
|
+
|
37
|
+
it 'returns a serialized example as string' do
|
38
|
+
expect(serialized).to eql input
|
39
|
+
end
|
34
40
|
end
|
35
41
|
|
36
42
|
context 'with name only' do
|
@@ -42,7 +48,7 @@ describe DocTest::Asciidoc::ExamplesSuite do
|
|
42
48
|
|
43
49
|
context 'with multiline content' do
|
44
50
|
let :content do
|
45
|
-
<<-EOF.
|
51
|
+
<<-EOF.unindent
|
46
52
|
Paragraphs don't require
|
47
53
|
any special markup.
|
48
54
|
|
@@ -58,7 +64,7 @@ describe DocTest::Asciidoc::ExamplesSuite do
|
|
58
64
|
|
59
65
|
context 'with description' do
|
60
66
|
let :input do
|
61
|
-
<<-EOF.
|
67
|
+
<<-EOF.unindent
|
62
68
|
// .strong
|
63
69
|
// This is a description,
|
64
70
|
// see?
|
@@ -73,11 +79,50 @@ describe DocTest::Asciidoc::ExamplesSuite do
|
|
73
79
|
|
74
80
|
include_examples :example
|
75
81
|
end
|
82
|
+
|
83
|
+
context 'with options' do
|
84
|
+
let :input do
|
85
|
+
<<-EOF.unindent
|
86
|
+
// .basic
|
87
|
+
// :exclude: /^=+.*/
|
88
|
+
// :exclude: /^#+.*/
|
89
|
+
// :include: /^----\\n(.*)\\n----/m
|
90
|
+
// :header_footer:
|
91
|
+
_dummy_
|
92
|
+
EOF
|
93
|
+
end
|
94
|
+
|
95
|
+
let :output do
|
96
|
+
create_example 's:basic', content: '_dummy_', opts: {
|
97
|
+
exclude: ['/^=+.*/', '/^#+.*/'],
|
98
|
+
include: ['/^----\\n(.*)\\n----/m'],
|
99
|
+
header_footer: true
|
100
|
+
}
|
101
|
+
end
|
102
|
+
include_examples :example
|
103
|
+
end
|
104
|
+
|
105
|
+
context 'with description and options' do
|
106
|
+
let :input do
|
107
|
+
<<-EOF.unindent
|
108
|
+
// .basic
|
109
|
+
// This is a description.
|
110
|
+
// :exclude: /^=+.*/
|
111
|
+
EOF
|
112
|
+
end
|
113
|
+
|
114
|
+
let :output do
|
115
|
+
create_example 's:basic', desc: 'This is a description.', opts: {
|
116
|
+
exclude: ['/^=+.*/']
|
117
|
+
}
|
118
|
+
end
|
119
|
+
include_examples :example
|
120
|
+
end
|
76
121
|
end
|
77
122
|
|
78
123
|
context 'multiple examples' do
|
79
124
|
let :input do
|
80
|
-
<<-EOF.
|
125
|
+
<<-EOF.unindent
|
81
126
|
// .basic
|
82
127
|
http://asciidoctor.org
|
83
128
|
|
data/spec/base_example_spec.rb
CHANGED
@@ -163,6 +163,8 @@ describe DocTest::BaseExample do
|
|
163
163
|
end
|
164
164
|
|
165
165
|
describe '#dup' do
|
166
|
+
using Corefines::Object::instance_values
|
167
|
+
|
166
168
|
it 'returns deep copy' do
|
167
169
|
origo = described_class.new('a:b', content: 'allons-y!', desc: 'who?', opts: {key: ['value']})
|
168
170
|
copy = origo.dup
|
@@ -1,4 +1,6 @@
|
|
1
|
-
require '
|
1
|
+
require 'forwardable'
|
2
|
+
|
3
|
+
using Corefines::String::unindent
|
2
4
|
|
3
5
|
describe DocTest::HTML::ExamplesSuite do
|
4
6
|
extend Forwardable
|
@@ -46,7 +48,7 @@ describe DocTest::HTML::ExamplesSuite do
|
|
46
48
|
|
47
49
|
context 'with multiline content' do
|
48
50
|
let :content do
|
49
|
-
<<-EOF.
|
51
|
+
<<-EOF.unindent
|
50
52
|
<p>Paragraphs don't require
|
51
53
|
any special markup.</p>
|
52
54
|
|
@@ -62,7 +64,7 @@ describe DocTest::HTML::ExamplesSuite do
|
|
62
64
|
|
63
65
|
context 'with description' do
|
64
66
|
let :input do
|
65
|
-
<<-EOF.
|
67
|
+
<<-EOF.unindent
|
66
68
|
<!-- .strong
|
67
69
|
This is a description,
|
68
70
|
see?
|
@@ -80,11 +82,12 @@ describe DocTest::HTML::ExamplesSuite do
|
|
80
82
|
|
81
83
|
context 'with options' do
|
82
84
|
let :input do
|
83
|
-
<<-EOF.
|
85
|
+
<<-EOF.unindent
|
84
86
|
<!-- .basic
|
85
87
|
:exclude: .//code
|
86
88
|
:exclude: .//section
|
87
89
|
:include: ./p/node()
|
90
|
+
:header_footer:
|
88
91
|
-->
|
89
92
|
<p>dummy</p>
|
90
93
|
EOF
|
@@ -93,34 +96,26 @@ describe DocTest::HTML::ExamplesSuite do
|
|
93
96
|
let :output do
|
94
97
|
create_example 's:basic', content: '<p>dummy</p>', opts: {
|
95
98
|
exclude: ['.//code', './/section'],
|
96
|
-
include: ['./p/node()']
|
99
|
+
include: ['./p/node()'],
|
100
|
+
header_footer: true
|
97
101
|
}
|
98
102
|
end
|
99
103
|
include_examples :example
|
100
104
|
end
|
101
105
|
|
102
|
-
context 'with boolean option' do
|
103
|
-
let(:input) { "<!-- .basic\n:header_footer:\n-->\n" }
|
104
|
-
let(:output) { create_example 's:basic', opts: { header_footer: true } }
|
105
|
-
|
106
|
-
include_examples :example
|
107
|
-
end
|
108
|
-
|
109
106
|
context 'with description and options' do
|
110
107
|
let :input do
|
111
|
-
<<-EOF.
|
108
|
+
<<-EOF.unindent
|
112
109
|
<!-- .basic
|
113
110
|
This is a description.
|
114
111
|
:exclude: .//code
|
115
|
-
:header_footer:
|
116
112
|
-->
|
117
113
|
EOF
|
118
114
|
end
|
119
115
|
|
120
116
|
let :output do
|
121
117
|
create_example 's:basic', desc: 'This is a description.', opts: {
|
122
|
-
exclude: ['.//code']
|
123
|
-
header_footer: true
|
118
|
+
exclude: ['.//code']
|
124
119
|
}
|
125
120
|
end
|
126
121
|
include_examples :example
|
@@ -129,7 +124,7 @@ describe DocTest::HTML::ExamplesSuite do
|
|
129
124
|
|
130
125
|
context 'multiple examples' do
|
131
126
|
let :input do
|
132
|
-
<<-EOF.
|
127
|
+
<<-EOF.unindent
|
133
128
|
<!-- .basic -->
|
134
129
|
http://asciidoctor.org
|
135
130
|
|
data/spec/minitest_diffy_spec.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
require 'active_support/core_ext/string/strip'
|
2
1
|
require 'asciidoctor/doctest/minitest_diffy'
|
2
|
+
require 'corefines'
|
3
|
+
|
4
|
+
using Corefines::String::color
|
3
5
|
|
4
6
|
describe Diffy::Format do
|
5
7
|
|
@@ -34,7 +36,7 @@ describe Diffy::Format do
|
|
34
36
|
let(:input) { ['+ <div><p>chunky bacon</p></div>'] }
|
35
37
|
|
36
38
|
it 'replaces "+" with "A", adds padding and colour' do
|
37
|
-
is_expected.to eq "\n" + 'A <div><p>chunky bacon</p></div>'.red
|
39
|
+
is_expected.to eq "\n" + 'A <div><p>chunky bacon</p></div>'.color(:red)
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
@@ -42,7 +44,7 @@ describe Diffy::Format do
|
|
42
44
|
let(:input) { ['- <p>chunky bacon</p>'] }
|
43
45
|
|
44
46
|
it 'replaces "-" with "E", adds padding and colour' do
|
45
|
-
is_expected.to eq "\n" + 'E <p>chunky bacon</p>'.green
|
47
|
+
is_expected.to eq "\n" + 'E <p>chunky bacon</p>'.color(:green)
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
@@ -1,7 +1,8 @@
|
|
1
|
-
require 'active_support/core_ext/array/access'
|
2
1
|
require 'fileutils'
|
3
2
|
require 'forwardable'
|
4
3
|
|
4
|
+
using Corefines::Array::second
|
5
|
+
|
5
6
|
shared_examples DocTest::BaseExamplesSuite do
|
6
7
|
extend Forwardable
|
7
8
|
|
@@ -253,6 +254,33 @@ shared_examples DocTest::BaseExamplesSuite do
|
|
253
254
|
end
|
254
255
|
|
255
256
|
|
257
|
+
describe '#format_options' do
|
258
|
+
|
259
|
+
shared_examples :format_options do |input, output|
|
260
|
+
it "returns #{output} for #{input}" do
|
261
|
+
expect(suite.send(:format_options, input)).to eq output
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
context 'empty' do
|
266
|
+
include_examples :format_options, {}, []
|
267
|
+
end
|
268
|
+
|
269
|
+
context 'options with one value' do
|
270
|
+
include_examples :format_options, {opt1: 'val1', opt2: 'val2'}, [':opt1: val1', ':opt2: val2']
|
271
|
+
end
|
272
|
+
|
273
|
+
context 'options with multiple values' do
|
274
|
+
include_examples :format_options, {opt1: %w[val11 val12], opt2: ['val2']},
|
275
|
+
[':opt1: val11', ':opt1: val12', ':opt2: val2']
|
276
|
+
end
|
277
|
+
|
278
|
+
context 'boolean options' do
|
279
|
+
include_examples :format_options, {opt1: true, opt2: false}, [':opt1:', ':opt2: false']
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
|
256
284
|
def create_and_write_group(path, group_name, file_ext, *examples)
|
257
285
|
content = [path, group_name + file_ext, *examples].join("\n")
|
258
286
|
File.write File.join(path, group_name + file_ext), content
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-doctest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Jirutka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: activesupport
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '4.1'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '4.1'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: asciidoctor
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,19 +25,19 @@ dependencies:
|
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
version: 1.5.0
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
28
|
+
name: corefines
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
31
|
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
33
|
+
version: 1.0.0
|
48
34
|
type: :runtime
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
38
|
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
40
|
+
version: 1.0.0
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: diffy
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +58,14 @@ dependencies:
|
|
72
58
|
requirements:
|
73
59
|
- - "~>"
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: '1.0'
|
76
62
|
type: :runtime
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
66
|
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
68
|
+
version: '1.0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: minitest
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,20 +100,14 @@ dependencies:
|
|
114
100
|
requirements:
|
115
101
|
- - "~>"
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.6.
|
118
|
-
- - "<"
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
version: 1.6.4
|
103
|
+
version: 1.6.0
|
121
104
|
type: :runtime
|
122
105
|
prerelease: false
|
123
106
|
version_requirements: !ruby/object:Gem::Requirement
|
124
107
|
requirements:
|
125
108
|
- - "~>"
|
126
109
|
- !ruby/object:Gem::Version
|
127
|
-
version: 1.6.
|
128
|
-
- - "<"
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: 1.6.4
|
110
|
+
version: 1.6.0
|
131
111
|
- !ruby/object:Gem::Dependency
|
132
112
|
name: bundler
|
133
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,6 +136,20 @@ dependencies:
|
|
156
136
|
- - "~>"
|
157
137
|
- !ruby/object:Gem::Version
|
158
138
|
version: '10.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: thread_safe
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.3'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.3'
|
159
153
|
- !ruby/object:Gem::Dependency
|
160
154
|
name: yard
|
161
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,14 +184,14 @@ dependencies:
|
|
190
184
|
requirements:
|
191
185
|
- - "~>"
|
192
186
|
- !ruby/object:Gem::Version
|
193
|
-
version:
|
187
|
+
version: 0.6.4
|
194
188
|
type: :development
|
195
189
|
prerelease: false
|
196
190
|
version_requirements: !ruby/object:Gem::Requirement
|
197
191
|
requirements:
|
198
192
|
- - "~>"
|
199
193
|
- !ruby/object:Gem::Version
|
200
|
-
version:
|
194
|
+
version: 0.6.4
|
201
195
|
- !ruby/object:Gem::Dependency
|
202
196
|
name: simplecov
|
203
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -357,12 +351,10 @@ files:
|
|
357
351
|
- lib/asciidoctor/doctest/asciidoc_renderer.rb
|
358
352
|
- lib/asciidoctor/doctest/base_example.rb
|
359
353
|
- lib/asciidoctor/doctest/base_examples_suite.rb
|
360
|
-
- lib/asciidoctor/doctest/core_ext.rb
|
361
354
|
- lib/asciidoctor/doctest/generator.rb
|
362
355
|
- lib/asciidoctor/doctest/generator_task.rb
|
363
356
|
- lib/asciidoctor/doctest/html/example.rb
|
364
357
|
- lib/asciidoctor/doctest/html/examples_suite.rb
|
365
|
-
- lib/asciidoctor/doctest/html/html_beautifier.rb
|
366
358
|
- lib/asciidoctor/doctest/html/normalizer.rb
|
367
359
|
- lib/asciidoctor/doctest/minitest_diffy.rb
|
368
360
|
- lib/asciidoctor/doctest/test.rb
|
@@ -370,13 +362,11 @@ files:
|
|
370
362
|
- spec/asciidoc/examples_suite_spec.rb
|
371
363
|
- spec/asciidoc_renderer_spec.rb
|
372
364
|
- spec/base_example_spec.rb
|
373
|
-
- spec/core_ext_spec.rb
|
374
365
|
- spec/html/examples_suite_spec.rb
|
375
366
|
- spec/html/normalizer_spec.rb
|
376
367
|
- spec/minitest_diffy_spec.rb
|
377
368
|
- spec/shared_examples/base_examples_suite.rb
|
378
369
|
- spec/spec_helper.rb
|
379
|
-
- spec/support/fakefs.rb
|
380
370
|
- spec/support/matchers.rb
|
381
371
|
- spec/test_spec.rb
|
382
372
|
homepage: https://github.com/asciidoctor/asciidoctor-doctest
|
@@ -399,7 +389,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
399
389
|
version: '0'
|
400
390
|
requirements: []
|
401
391
|
rubyforge_project:
|
402
|
-
rubygems_version: 2.4.
|
392
|
+
rubygems_version: 2.4.6
|
403
393
|
signing_key:
|
404
394
|
specification_version: 4
|
405
395
|
summary: Test suite for Asciidoctor backends
|
@@ -425,13 +415,11 @@ test_files:
|
|
425
415
|
- spec/asciidoc/examples_suite_spec.rb
|
426
416
|
- spec/asciidoc_renderer_spec.rb
|
427
417
|
- spec/base_example_spec.rb
|
428
|
-
- spec/core_ext_spec.rb
|
429
418
|
- spec/html/examples_suite_spec.rb
|
430
419
|
- spec/html/normalizer_spec.rb
|
431
420
|
- spec/minitest_diffy_spec.rb
|
432
421
|
- spec/shared_examples/base_examples_suite.rb
|
433
422
|
- spec/spec_helper.rb
|
434
|
-
- spec/support/fakefs.rb
|
435
423
|
- spec/support/matchers.rb
|
436
424
|
- spec/test_spec.rb
|
437
425
|
has_rdoc: yard
|
@@ -1,64 +0,0 @@
|
|
1
|
-
module Enumerable
|
2
|
-
|
3
|
-
##
|
4
|
-
# Sends a message to each element and collects the result.
|
5
|
-
#
|
6
|
-
# @example
|
7
|
-
# [1, 2, 3].map_send(:+, 3) #=> [4, 5, 6]
|
8
|
-
#
|
9
|
-
# @param method_name [Symbol] name of the public method to call.
|
10
|
-
# @param args arguments to pass to the method.
|
11
|
-
# @param block [Proc] block to pass to the method.
|
12
|
-
# @return [Enumerable]
|
13
|
-
#
|
14
|
-
def map_send(method_name, *args, &block)
|
15
|
-
map { |e| e.public_send(method_name, *args, &block) }
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class Module
|
20
|
-
|
21
|
-
##
|
22
|
-
# Makes +new_name+ a new copy of the class method +old_name+.
|
23
|
-
#
|
24
|
-
# @param new_name [Symbol] name of the new class method to create.
|
25
|
-
# @param old_name [Symbol] name of the existing class method to alias.
|
26
|
-
#
|
27
|
-
def alias_class_method(new_name, old_name)
|
28
|
-
singleton_class.send(:alias_method, new_name, old_name)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
class String
|
33
|
-
|
34
|
-
##
|
35
|
-
# Appends (concatenates) the given object to +str+.
|
36
|
-
#
|
37
|
-
# @param obj [String, Integer] the string, or codepoint to append.
|
38
|
-
# @param separator [String, nil] the separator to append when this +str+ is
|
39
|
-
# not empty.
|
40
|
-
# @return [String] self
|
41
|
-
#
|
42
|
-
def concat(obj, separator = nil)
|
43
|
-
if separator && !self.empty?
|
44
|
-
self << separator << obj
|
45
|
-
else
|
46
|
-
self << obj
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
# Workarounds for JRuby.
|
53
|
-
if RUBY_ENGINE == 'jruby'
|
54
|
-
require 'delegate'
|
55
|
-
|
56
|
-
# @private
|
57
|
-
class SimpleDelegator
|
58
|
-
|
59
|
-
# https://github.com/jruby/jruby/issues/2412
|
60
|
-
def warn(*msg)
|
61
|
-
Kernel.warn(*msg)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'htmlbeautifier'
|
2
|
-
|
3
|
-
module HtmlBeautifier
|
4
|
-
|
5
|
-
##
|
6
|
-
# Beautifies the +input+ HTML.
|
7
|
-
#
|
8
|
-
# @param input [String, #to_html]
|
9
|
-
# @return [String] a beautified copy of the +input+.
|
10
|
-
#
|
11
|
-
def self.beautify(input)
|
12
|
-
input = input.to_html unless input.is_a? String
|
13
|
-
output = []
|
14
|
-
Beautifier.new(output).scan(input)
|
15
|
-
output.join
|
16
|
-
end
|
17
|
-
end
|
data/spec/core_ext_spec.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
describe Enumerable do
|
2
|
-
|
3
|
-
describe '#map_send' do
|
4
|
-
|
5
|
-
it 'sends a message to each element and collects the result' do
|
6
|
-
expect([1, 2, 3].map_send(:+, 3)).to eq [4, 5, 6]
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
describe String do
|
12
|
-
|
13
|
-
describe '#concat' do
|
14
|
-
|
15
|
-
context 'without separator' do
|
16
|
-
subject { 'foo' }
|
17
|
-
|
18
|
-
it 'appends the given string to self' do
|
19
|
-
subject.concat 'bar'
|
20
|
-
is_expected.to eq 'foobar'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'with separator' do
|
25
|
-
|
26
|
-
context 'when self is empty' do
|
27
|
-
subject { '' }
|
28
|
-
|
29
|
-
it 'appends the given string to self' do
|
30
|
-
subject.concat 'bar', "\n"
|
31
|
-
is_expected.to eq 'bar'
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context 'when self is not empty' do
|
36
|
-
subject { 'foo' }
|
37
|
-
|
38
|
-
it 'appends the given separator and string to self' do
|
39
|
-
subject.concat 'bar', "\n"
|
40
|
-
is_expected.to eq "foo\nbar"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
describe Module do
|
49
|
-
|
50
|
-
describe '#alias_class_method' do
|
51
|
-
|
52
|
-
subject(:klass) do
|
53
|
-
Class.new do
|
54
|
-
def self.salute
|
55
|
-
'Meow!'
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'defines new class method that calls the old class method' do
|
61
|
-
klass.alias_class_method :say_hello!, :salute
|
62
|
-
|
63
|
-
expect(klass).to respond_to :say_hello!
|
64
|
-
expect(klass.say_hello!).to eq klass.salute
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
data/spec/support/fakefs.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'fakefs/spec_helpers'
|
2
|
-
|
3
|
-
module FakeFS
|
4
|
-
# XXX remove after merging of https://github.com/defunkt/fakefs/pull/270
|
5
|
-
module FileTest
|
6
|
-
|
7
|
-
def readable?(file_name)
|
8
|
-
File.readable?(file_name)
|
9
|
-
end
|
10
|
-
module_function :readable?
|
11
|
-
end
|
12
|
-
|
13
|
-
# XXX remove after merging of https://github.com/defunkt/fakefs/pull/269
|
14
|
-
class Pathname
|
15
|
-
def read(*args)
|
16
|
-
File.read(@path, *args)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|