-
-
Notifications
You must be signed in to change notification settings - Fork 156
/
test_word_to_markdown_document.rb
41 lines (31 loc) · 1.02 KB
/
test_word_to_markdown_document.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true
require File.join(File.dirname(__FILE__), 'helper')
class TestWordToMarkdownDocument < Minitest::Test
def setup
@doc = WordToMarkdown::Document.new fixture_path('em')
end
def scrub_whitespace(string)
@doc.send(:scrub_whitespace, string)
end
should 'convert html-encoded spaces' do
assert_equal 'foo bar', scrub_whitespace('foo bar')
end
should 'strip leading whitespace' do
assert_equal "foo\n bar", scrub_whitespace(" foo\n bar")
end
should 'strip trailing whitespace' do
assert_equal "foo\n bar", scrub_whitespace("foo\n bar ")
end
should 'strip line-trailing whitespace' do
assert_equal "foo\n bar", scrub_whitespace("foo \n bar")
end
should 'strip whitespace lines' do
assert_equal "foo\n\nbar", scrub_whitespace("foo\n \nbar")
end
should 'strip quadruple line breaks' do
assert_equal "foo\n\nbar", scrub_whitespace("foo\n\n \n\nbar")
end
should 'strip unicode breaks' do
assert_equal '', scrub_whitespace("\u00A0")
end
end