Skip to content

Commit

Permalink
test subdir allocation for EPUBMaker
Browse files Browse the repository at this point in the history
  • Loading branch information
kmuto committed Jul 31, 2024
1 parent 4e7f9c2 commit 61ff7d8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/test_epubmaker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,9 @@ def error(s)
File.write(File.join(tmpdir, 'exist.css'), 'body {}')
File.write(File.join(tmpdir, 'exist.html'), '<html></html>')

Dir.mkdir(File.join(tmpdir, 'subdir'))
File.write(File.join(tmpdir, 'subdir', 'exist.html'), '<html></html>')

Dir.chdir(tmpdir) do
Dir.mkdir('test')
yield(epubmaker, File.join(tmpdir, 'test'))
Expand All @@ -897,6 +900,9 @@ def test_copy_static_file
epubmaker.config['titlefile'] = 'exist.html'
assert_nothing_raised { epubmaker.copy_frontmatter(tmpdir) }

epubmaker.config['titlefile'] = 'subdir/exist.html'
assert_nothing_raised { epubmaker.copy_frontmatter(tmpdir) }

epubmaker.config['titlefile'] = 'nothing.html'
@log_io.string = ''
assert_raise(SystemExit) { epubmaker.copy_frontmatter(tmpdir) }
Expand All @@ -909,6 +915,9 @@ def test_copy_static_file
epubmaker.config[name] = 'exist.html'
assert_nothing_raised { epubmaker.copy_frontmatter(tmpdir) }

epubmaker.config[name] = 'subdir/exist.html'
assert_nothing_raised { epubmaker.copy_frontmatter(tmpdir) }

epubmaker.config[name] = 'nothing.html'
@log_io.string = ''
assert_raise(SystemExit) { epubmaker.copy_frontmatter(tmpdir) }
Expand All @@ -921,6 +930,9 @@ def test_copy_static_file
epubmaker.config[name] = 'exist.html'
assert_nothing_raised { epubmaker.copy_backmatter(tmpdir) }

epubmaker.config[name] = 'subdir/exist.html'
assert_nothing_raised { epubmaker.copy_backmatter(tmpdir) }

epubmaker.config[name] = 'nothing.html'
@log_io.string = ''
assert_raise(SystemExit) { epubmaker.copy_backmatter(tmpdir) }
Expand Down

0 comments on commit 61ff7d8

Please sign in to comment.