greenmat 3.2.0.2 → 3.2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +33 -0
- data/bin/greenmat +40 -4
- data/ext/greenmat/buffer.c +6 -6
- data/ext/greenmat/buffer.h +1 -1
- data/ext/greenmat/gm_markdown.c +7 -3
- data/ext/greenmat/gm_render.c +8 -13
- data/ext/greenmat/html.c +25 -81
- data/ext/greenmat/html.h +1 -7
- data/ext/greenmat/markdown.c +8 -17
- data/ext/greenmat/markdown.h +3 -0
- data/greenmat.gemspec +2 -1
- data/lib/greenmat.rb +1 -1
- data/lib/greenmat/compat.rb +3 -0
- data/lib/greenmat/version.rb +1 -1
- data/tasks/greenmat.rake +32 -1
- data/test/custom_render_test.rb +1 -1
- data/test/greenmat_compat_test.rb +6 -6
- data/test/html_render_test.rb +76 -77
- data/test/html_toc_render_test.rb +9 -36
- data/test/markdown_test.rb +26 -52
- data/test/test_helper.rb +11 -15
- metadata +18 -7
- data/lib/greenmat/cli.rb +0 -86
- data/test/greenmat_bin_test.rb +0 -80
data/test/markdown_test.rb
CHANGED
@@ -18,37 +18,37 @@ class MarkdownTest < Greenmat::TestCase
|
|
18
18
|
|
19
19
|
def test_that_simple_one_liner_goes_to_html
|
20
20
|
assert_respond_to @markdown, :render
|
21
|
-
|
21
|
+
html_equal "<p>Hello World.</p>\n", @markdown.render("Hello World.")
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_that_inline_markdown_goes_to_html
|
25
25
|
markdown = @markdown.render('_Hello World_!')
|
26
|
-
|
26
|
+
html_equal "<p><em>Hello World</em>!</p>\n", markdown
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_that_inline_markdown_starts_and_ends_correctly
|
30
30
|
markdown = render_with({:no_intra_emphasis => true}, '_start _ foo_bar bar_baz _ end_ *italic* **bold** <a>_blah_</a>')
|
31
31
|
|
32
|
-
|
32
|
+
html_equal "<p><em>start _ foo_bar bar_baz _ end</em> <em>italic</em> <strong>bold</strong> <a><em>blah</em></a></p>\n", markdown
|
33
33
|
|
34
34
|
markdown = @markdown.render("Run 'rake radiant:extensions:rbac_base:migrate'")
|
35
|
-
|
35
|
+
html_equal "<p>Run 'rake radiant:extensions:rbac_base:migrate'</p>\n", markdown
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_that_urls_are_not_doubly_escaped
|
39
39
|
markdown = @markdown.render('[Page 2](/search?query=Markdown+Test&page=2)')
|
40
|
-
|
40
|
+
html_equal "<p><a href=\"/search?query=Markdown+Test&page=2\">Page 2</a></p>\n", markdown
|
41
41
|
end
|
42
42
|
|
43
43
|
def test_simple_inline_html
|
44
44
|
#markdown = Markdown.new("before\n\n<div>\n foo\n</div>\nafter")
|
45
45
|
markdown = @markdown.render("before\n\n<div>\n foo\n</div>\n\nafter")
|
46
|
-
|
46
|
+
html_equal "<p>before</p>\n\n<div>\n foo\n</div>\n\n<p>after</p>\n", markdown
|
47
47
|
end
|
48
48
|
|
49
49
|
def test_that_html_blocks_do_not_require_their_own_end_tag_line
|
50
50
|
markdown = @markdown.render("Para 1\n\n<div><pre>HTML block\n</pre></div>\n\nPara 2 [Link](#anchor)")
|
51
|
-
|
51
|
+
html_equal "<p>Para 1</p>\n\n<div><pre>HTML block\n</pre></div>\n\n<p>Para 2 <a href=\"#anchor\">Link</a></p>\n",
|
52
52
|
markdown
|
53
53
|
end
|
54
54
|
|
@@ -58,8 +58,8 @@ class MarkdownTest < Greenmat::TestCase
|
|
58
58
|
"A wise man once said:\n\n" +
|
59
59
|
" > Isn't it wonderful just to be alive.\n"
|
60
60
|
)
|
61
|
-
|
62
|
-
"<blockquote
|
61
|
+
html_equal "<p>A wise man once said:</p>\n\n" +
|
62
|
+
"<blockquote><p>Isn't it wonderful just to be alive.</p>\n</blockquote>\n",
|
63
63
|
markdown
|
64
64
|
end
|
65
65
|
|
@@ -68,7 +68,7 @@ class MarkdownTest < Greenmat::TestCase
|
|
68
68
|
"Things to watch out for\n" +
|
69
69
|
"<ul>\n<li>Blah</li>\n</ul>\n")
|
70
70
|
|
71
|
-
|
71
|
+
html_equal "<p>Things to watch out for</p>\n\n" +
|
72
72
|
"<ul>\n<li>Blah</li>\n</ul>\n", markdown
|
73
73
|
end
|
74
74
|
|
@@ -90,7 +90,7 @@ MARKDOWN
|
|
90
90
|
|
91
91
|
<p>This paragraph is not part of the list.</p>
|
92
92
|
HTML
|
93
|
-
|
93
|
+
html_equal expected, @markdown.render(text)
|
94
94
|
end
|
95
95
|
|
96
96
|
# http://github.com/rtomayko/rdiscount/issues/#issue/13
|
@@ -98,37 +98,37 @@ HTML
|
|
98
98
|
text = "The Ant-Sugar Tales \n" +
|
99
99
|
"=================== \n\n" +
|
100
100
|
"By Candice Yellowflower \n"
|
101
|
-
|
101
|
+
html_equal "<h1>The Ant-Sugar Tales </h1>\n\n<p>By Candice Yellowflower </p>\n", @markdown.render(text)
|
102
102
|
end
|
103
103
|
|
104
104
|
def test_that_intra_emphasis_works
|
105
105
|
rd = render_with({}, "foo_bar_baz")
|
106
|
-
|
106
|
+
html_equal "<p>foo<em>bar</em>baz</p>\n", rd
|
107
107
|
|
108
108
|
rd = render_with({:no_intra_emphasis => true},"foo_bar_baz")
|
109
|
-
|
109
|
+
html_equal "<p>foo_bar_baz</p>\n", rd
|
110
110
|
end
|
111
111
|
|
112
112
|
def test_that_autolink_flag_works
|
113
113
|
rd = render_with({:autolink => true}, "http://github.com/rtomayko/rdiscount")
|
114
|
-
|
114
|
+
html_equal "<p><a href=\"http://github.com/rtomayko/rdiscount\">http://github.com/rtomayko/rdiscount</a></p>\n", rd
|
115
115
|
end
|
116
116
|
|
117
117
|
def test_that_tags_can_have_dashes_and_underscores
|
118
118
|
rd = @markdown.render("foo <asdf-qwerty>bar</asdf-qwerty> and <a_b>baz</a_b>")
|
119
|
-
|
119
|
+
html_equal "<p>foo <asdf-qwerty>bar</asdf-qwerty> and <a_b>baz</a_b></p>\n", rd
|
120
120
|
end
|
121
121
|
|
122
122
|
def test_link_syntax_is_not_processed_within_code_blocks
|
123
123
|
markdown = @markdown.render(" This is a code block\n This is a link [[1]] inside\n")
|
124
|
-
|
124
|
+
html_equal "<pre><code>This is a code block\nThis is a link [[1]] inside\n</code></pre>\n",
|
125
125
|
markdown
|
126
126
|
end
|
127
127
|
|
128
128
|
def test_whitespace_after_urls
|
129
129
|
rd = render_with({:autolink => true}, "Japan: http://www.abc.net.au/news/events/japan-quake-2011/beforeafter.htm (yes, japan)")
|
130
130
|
exp = %{<p>Japan: <a href="http://www.abc.net.au/news/events/japan-quake-2011/beforeafter.htm">http://www.abc.net.au/news/events/japan-quake-2011/beforeafter.htm</a> (yes, japan)</p>\n}
|
131
|
-
|
131
|
+
html_equal exp, rd
|
132
132
|
end
|
133
133
|
|
134
134
|
def test_memory_leak_when_parsing_char_links
|
@@ -147,7 +147,7 @@ HTML
|
|
147
147
|
end
|
148
148
|
|
149
149
|
def test_infinite_loop_in_header
|
150
|
-
|
150
|
+
html_equal "<h1>Body</h1>\n", @markdown.render(<<-header)
|
151
151
|
######
|
152
152
|
#Body#
|
153
153
|
######
|
@@ -155,8 +155,8 @@ HTML
|
|
155
155
|
end
|
156
156
|
|
157
157
|
def test_a_hyphen_and_a_equal_should_not_be_converted_to_heading
|
158
|
-
|
159
|
-
|
158
|
+
html_equal "<p>-</p>\n", @markdown.render("-")
|
159
|
+
html_equal "<p>=</p>\n", @markdown.render("=")
|
160
160
|
end
|
161
161
|
|
162
162
|
def test_that_tables_flag_works
|
@@ -243,32 +243,6 @@ fenced
|
|
243
243
|
assert !out.include?("<pre><code>")
|
244
244
|
end
|
245
245
|
|
246
|
-
def test_that_indented_code_preserves_references
|
247
|
-
text = <<indented
|
248
|
-
This is normal text
|
249
|
-
|
250
|
-
Link to [Google][1]
|
251
|
-
|
252
|
-
[1]: http://google.com
|
253
|
-
indented
|
254
|
-
out = Greenmat::Markdown.new(Greenmat::Render::HTML, :fenced_code_blocks => true).render(text)
|
255
|
-
assert out.include?("[1]: http://google.com")
|
256
|
-
end
|
257
|
-
|
258
|
-
def test_that_fenced_flag_preserves_references
|
259
|
-
text = <<fenced
|
260
|
-
This is normal text
|
261
|
-
|
262
|
-
```
|
263
|
-
Link to [Google][1]
|
264
|
-
|
265
|
-
[1]: http://google.com
|
266
|
-
```
|
267
|
-
fenced
|
268
|
-
out = Greenmat::Markdown.new(Greenmat::Render::HTML, :fenced_code_blocks => true).render(text)
|
269
|
-
assert out.include?("[1]: http://google.com")
|
270
|
-
end
|
271
|
-
|
272
246
|
def test_that_indented_flag_works
|
273
247
|
text = <<indented
|
274
248
|
This is a simple text
|
@@ -285,14 +259,14 @@ indented
|
|
285
259
|
|
286
260
|
def test_that_headers_are_linkable
|
287
261
|
markdown = @markdown.render('### Hello [GitHub](http://github.com)')
|
288
|
-
|
262
|
+
html_equal "<h3>Hello <a href=\"http://github.com\">GitHub</a></h3>\n", markdown
|
289
263
|
end
|
290
264
|
|
291
265
|
def test_autolinking_with_ent_chars
|
292
266
|
markdown = render_with({:autolink => true}, <<text)
|
293
267
|
This a stupid link: https://github.com/rtomayko/tilt/issues?milestone=1&state=open
|
294
268
|
text
|
295
|
-
|
269
|
+
html_equal "<p>This a stupid link: <a href=\"https://github.com/rtomayko/tilt/issues?milestone=1&state=open\">https://github.com/rtomayko/tilt/issues?milestone=1&state=open</a></p>\n", markdown
|
296
270
|
end
|
297
271
|
|
298
272
|
def test_spaced_headers
|
@@ -318,13 +292,13 @@ text
|
|
318
292
|
|
319
293
|
def test_emphasis_escaping
|
320
294
|
markdown = @markdown.render("**foo\\*** _dd\\_dd_")
|
321
|
-
|
295
|
+
html_equal "<p><strong>foo*</strong> <em>dd_dd</em></p>\n", markdown
|
322
296
|
end
|
323
297
|
|
324
298
|
def test_char_escaping_when_highlighting
|
325
299
|
markdown = "==attribute\\==="
|
326
300
|
output = render_with({highlight: true}, markdown)
|
327
|
-
|
301
|
+
html_equal "<p><mark>attribute=</mark></p>\n", output
|
328
302
|
end
|
329
303
|
|
330
304
|
def test_ordered_lists_with_lax_spacing
|
@@ -337,6 +311,6 @@ text
|
|
337
311
|
|
338
312
|
def test_references_with_tabs_after_colon
|
339
313
|
markdown = @markdown.render("[Link][id]\n[id]:\t\t\thttp://google.es")
|
340
|
-
|
314
|
+
html_equal "<p><a href=\"http://google.es\">Link</a></p>\n", markdown
|
341
315
|
end
|
342
316
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,33 +1,29 @@
|
|
1
1
|
# coding: UTF-8
|
2
2
|
Encoding.default_internal = 'UTF-8' if defined? Encoding
|
3
3
|
|
4
|
+
gem 'test-unit', '>= 2' # necessary when not using bundle exec
|
5
|
+
|
4
6
|
require 'test/unit'
|
7
|
+
require 'nokogiri'
|
5
8
|
|
6
9
|
require 'greenmat'
|
7
10
|
require 'greenmat/render_strip'
|
8
11
|
require 'greenmat/render_man'
|
12
|
+
require 'greenmat/compat'
|
9
13
|
|
10
14
|
class Greenmat::TestCase < Test::Unit::TestCase
|
11
|
-
def
|
12
|
-
assert_equal
|
15
|
+
def html_equal(html_a, html_b)
|
16
|
+
assert_equal Nokogiri::HTML::DocumentFragment.parse(html_a).to_html,
|
17
|
+
Nokogiri::HTML::DocumentFragment.parse(html_b).to_html
|
13
18
|
end
|
14
19
|
|
15
|
-
def
|
16
|
-
|
17
|
-
|
18
|
-
if options.kind_of?(Array)
|
19
|
-
options = Hash[options.map {|o| [o, true]}]
|
20
|
-
end
|
21
|
-
|
22
|
-
render = renderer.new(options)
|
23
|
-
parser = Greenmat::Markdown.new(render, options)
|
24
|
-
|
25
|
-
parser.render(markdown)
|
20
|
+
def assert_renders(html, markdown)
|
21
|
+
html_equal html, parser.render(markdown)
|
26
22
|
end
|
27
23
|
|
28
24
|
private
|
29
25
|
|
30
|
-
def
|
31
|
-
@
|
26
|
+
def parser
|
27
|
+
@parser ||= Greenmat::Markdown.new(Greenmat::Render::HTML)
|
32
28
|
end
|
33
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: greenmat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.0
|
4
|
+
version: 3.2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Natacha Porté
|
@@ -9,8 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-03-
|
12
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: nokogiri
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.6.0
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 1.6.0
|
14
28
|
- !ruby/object:Gem::Dependency
|
15
29
|
name: rake-compiler
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,14 +73,14 @@ dependencies:
|
|
59
73
|
requirements:
|
60
74
|
- - "~>"
|
61
75
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
76
|
+
version: 2.5.4
|
63
77
|
type: :development
|
64
78
|
prerelease: false
|
65
79
|
version_requirements: !ruby/object:Gem::Requirement
|
66
80
|
requirements:
|
67
81
|
- - "~>"
|
68
82
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
83
|
+
version: 2.5.4
|
70
84
|
description: A Markdown parser for Qiita, based on Redcarpet.
|
71
85
|
email: nkymyj@gmail.com
|
72
86
|
executables:
|
@@ -106,7 +120,6 @@ files:
|
|
106
120
|
- ext/greenmat/stack.h
|
107
121
|
- greenmat.gemspec
|
108
122
|
- lib/greenmat.rb
|
109
|
-
- lib/greenmat/cli.rb
|
110
123
|
- lib/greenmat/compat.rb
|
111
124
|
- lib/greenmat/render_man.rb
|
112
125
|
- lib/greenmat/render_strip.rb
|
@@ -203,7 +216,6 @@ files:
|
|
203
216
|
- test/benchmark.rb
|
204
217
|
- test/custom_render_test.rb
|
205
218
|
- test/fixtures/benchmark.md
|
206
|
-
- test/greenmat_bin_test.rb
|
207
219
|
- test/greenmat_compat_test.rb
|
208
220
|
- test/html5_test.rb
|
209
221
|
- test/html_render_test.rb
|
@@ -329,7 +341,6 @@ test_files:
|
|
329
341
|
- test/benchmark.rb
|
330
342
|
- test/custom_render_test.rb
|
331
343
|
- test/fixtures/benchmark.md
|
332
|
-
- test/greenmat_bin_test.rb
|
333
344
|
- test/greenmat_compat_test.rb
|
334
345
|
- test/html5_test.rb
|
335
346
|
- test/html_render_test.rb
|
data/lib/greenmat/cli.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
require 'greenmat'
|
2
|
-
require 'optparse'
|
3
|
-
|
4
|
-
module Greenmat
|
5
|
-
# This class aims at easing the creation of custom
|
6
|
-
# binary for your needs. For example, you can add new
|
7
|
-
# options or change the existing ones. The parsing
|
8
|
-
# is handled by Ruby's OptionParser. For instance:
|
9
|
-
#
|
10
|
-
# class Custom::CLI < Greenmat::CLI
|
11
|
-
# def self.options_parser
|
12
|
-
# super.tap do |opts|
|
13
|
-
# opts.on("--rainbow") do
|
14
|
-
# @@options[:rainbow] = true
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
# end
|
18
|
-
#
|
19
|
-
# def self.render_object
|
20
|
-
# @@options[:rainbow] ? RainbowRender : super
|
21
|
-
# end
|
22
|
-
# end
|
23
|
-
class CLI
|
24
|
-
def self.options_parser
|
25
|
-
@@options = {
|
26
|
-
render_extensions: {},
|
27
|
-
parse_extensions: {},
|
28
|
-
smarty_pants: false
|
29
|
-
}
|
30
|
-
|
31
|
-
OptionParser.new do |opts|
|
32
|
-
opts.banner = "Usage: greenmat [--parse <extension>...] " \
|
33
|
-
"[--render <extension>...] [--smarty] <file>..."
|
34
|
-
|
35
|
-
opts.on("--parse EXTENSION", "Enable a parsing extension") do |ext|
|
36
|
-
ext = ext.gsub('-', '_').to_sym
|
37
|
-
@@options[:parse_extensions][ext] = true
|
38
|
-
end
|
39
|
-
|
40
|
-
opts.on("--render EXTENSION", "Enable a rendering extension") do |ext|
|
41
|
-
ext = ext.gsub('-', '_').to_sym
|
42
|
-
@@options[:render_extensions][ext] = true
|
43
|
-
end
|
44
|
-
|
45
|
-
opts.on("--smarty", "Enable Smarty Pants") do
|
46
|
-
@@options[:smarty_pants] = true
|
47
|
-
end
|
48
|
-
|
49
|
-
opts.on_tail("-v", "--version", "Display the current version") do
|
50
|
-
STDOUT.write "Greenmat #{Greenmat::VERSION}"
|
51
|
-
exit
|
52
|
-
end
|
53
|
-
|
54
|
-
opts.on_tail("-h", "--help", "Display this help message") do
|
55
|
-
puts opts
|
56
|
-
exit
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def self.process(args)
|
62
|
-
self.legacy_parse!(args)
|
63
|
-
self.options_parser.parse!(args)
|
64
|
-
STDOUT.write parser_object.render(ARGF.read)
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.render_object
|
68
|
-
@@options[:smarty_pants] ? Render::SmartyHTML : Render::HTML
|
69
|
-
end
|
70
|
-
|
71
|
-
def self.parser_object
|
72
|
-
renderer = render_object.new(@@options[:render_extensions])
|
73
|
-
Greenmat::Markdown.new(renderer, @@options[:parse_extensions])
|
74
|
-
end
|
75
|
-
|
76
|
-
def self.legacy_parse!(args) # :nodoc:
|
77
|
-
# Workaround for backward compatibility as OptionParser
|
78
|
-
# doesn't support the --flag-OPTION syntax.
|
79
|
-
args.select {|a| a =~ /--(parse|render)-/ }.each do |arg|
|
80
|
-
args.delete(arg)
|
81
|
-
arg = arg.partition(/\b-/)
|
82
|
-
args.push(arg.first, arg.last)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
data/test/greenmat_bin_test.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'tempfile'
|
3
|
-
|
4
|
-
class GreenmatBinTest < Greenmat::TestCase
|
5
|
-
def setup
|
6
|
-
@fixture_file = Tempfile.new('bin')
|
7
|
-
@fixture_path = @fixture_file.path
|
8
|
-
|
9
|
-
@fixture_file.write "A ==simple== fixture file -- with " \
|
10
|
-
"a [link](https://github.com)."
|
11
|
-
@fixture_file.rewind
|
12
|
-
end
|
13
|
-
|
14
|
-
def teardown
|
15
|
-
@fixture_file.unlink
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_vanilla_bin
|
19
|
-
run_bin(@fixture_path)
|
20
|
-
|
21
|
-
expected = "<p>A ==simple== fixture file -- with " \
|
22
|
-
"a <a href=\"https://github.com\">link</a>.</p>\n"
|
23
|
-
|
24
|
-
assert_equal expected, @output
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_enabling_a_parse_option
|
28
|
-
run_bin("--parse", "highlight", @fixture_path)
|
29
|
-
|
30
|
-
assert_output "<mark>"
|
31
|
-
refute_output "=="
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_enabling_a_render_option
|
35
|
-
run_bin("--render", "no-links", @fixture_path)
|
36
|
-
|
37
|
-
assert_output "[link]"
|
38
|
-
refute_output "</a>"
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_enabling_smarty_pants
|
42
|
-
run_bin("--smarty", @fixture_path)
|
43
|
-
|
44
|
-
assert_output "&ndash"
|
45
|
-
refute_output "--"
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_version_option
|
49
|
-
run_bin("--version")
|
50
|
-
assert_output "Greenmat #{Greenmat::VERSION}"
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_legacy_option_parsing
|
54
|
-
run_bin("--parse-highlight", "--render-no-links", @fixture_path)
|
55
|
-
|
56
|
-
assert_output "<mark>"
|
57
|
-
refute_output "=="
|
58
|
-
|
59
|
-
assert_output "[link]"
|
60
|
-
refute_output "</a>"
|
61
|
-
end
|
62
|
-
|
63
|
-
private
|
64
|
-
|
65
|
-
def run_bin(*args)
|
66
|
-
bin_path = File.expand_path('../../bin/greenmat', __FILE__)
|
67
|
-
|
68
|
-
IO.popen("#{bin_path} #{args.join(" ")}") do |stream|
|
69
|
-
@output = stream.read
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def assert_output(pattern)
|
74
|
-
assert_match pattern, @output
|
75
|
-
end
|
76
|
-
|
77
|
-
def refute_output(pattern)
|
78
|
-
refute_match Regexp.new(pattern), @output
|
79
|
-
end
|
80
|
-
end
|