Skip to content

Commit 571354e

Browse files
committed
Added failing assertions to issue #11
1 parent a106a51 commit 571354e

7 files changed

Lines changed: 28 additions & 0 deletions
Binary file not shown.
Binary file not shown.

test/unit/test_convert_to_pdf.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ def test_rtf_conversion
1212
assert Dir["#{OUTPUT}/*.pdf"] == ["#{OUTPUT}/obama_hopes.pdf"]
1313
end
1414

15+
def test_png_conversion
16+
Docsplit.extract_pdf('test/fixtures/image.png', :output => OUTPUT)
17+
assert Dir["#{OUTPUT}/*.pdf"] == ["#{OUTPUT}/image.pdf"]
18+
end
1519
def test_png_conversion
1620
Docsplit.extract_pdf('test/fixtures/image.png', :output => OUTPUT)
1721
assert Dir["#{OUTPUT}/*.pdf"] == ["#{OUTPUT}/image.pdf"]
@@ -23,4 +27,9 @@ def test_conversion_then_page_extraction
2327
assert Dir["#{OUTPUT}/*.pdf"].length == 8
2428
end
2529

30+
def test_name_escaping_while_converting
31+
Docsplit.extract_pdf('test/fixtures/PDF file with spaces \'single\' and "double quotes".doc', :output => OUTPUT)
32+
assert Dir["#{OUTPUT}/*.pdf"] == ["#{OUTPUT}/PDF file with spaces 'single' and \"double quotes\".pdf"]
33+
end
34+
2635
end

test/unit/test_extract_images.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,9 @@ def test_repeated_extraction_in_the_same_directory
4141
assert Dir["#{OUTPUT}/*"] == ['test/output/obama_arts_1.gif', 'test/output/obama_arts_2.gif']
4242
end
4343

44+
def test_name_escaping_while_extracting_images
45+
Docsplit.extract_images('test/fixtures/PDF file with spaces \'single\' and "double quotes".pdf', :format => :gif, :size => "250x", :output => OUTPUT)
46+
assert Dir["#{OUTPUT}/*"] == ['test/output/PDF file with spaces \'single\' and "double quotes"_1.gif', 'test/output/PDF file with spaces \'single\' and "double quotes"_2.gif']
47+
end
48+
4449
end

test/unit/test_extract_info.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,8 @@ def test_password_protected
3232
end
3333
end
3434

35+
def test_name_escaping_while_extracting_info
36+
assert 2 == Docsplit.extract_length('test/fixtures/PDF file with spaces \'single\' and "double quotes".pdf')
37+
end
38+
3539
end

test/unit/test_extract_pages.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@ def test_doc_page_extraction
1818
assert Dir["#{OUTPUT}/*.pdf"].length == 7
1919
end
2020

21+
def test_name_escaping_while_extracting_pages
22+
Docsplit.extract_pages('test/fixtures/PDF file with spaces \'single\' and "double quotes".pdf', :output => OUTPUT)
23+
assert Dir["#{OUTPUT}/*.pdf"].length == 2
24+
end
25+
2126
end

test/unit/test_extract_text.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,9 @@ def test_password_protected
4444
end
4545
end
4646

47+
def test_name_escaping_while_extracting_text
48+
Docsplit.extract_text('test/fixtures/PDF file with spaces \'single\' and "double quotes".pdf', :pages => 'all', :output => OUTPUT)
49+
assert Dir["#{OUTPUT}/*.txt"].length == 2
50+
end
51+
4752
end

0 commit comments

Comments
 (0)