rake4latex 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/{call_rake4latex.rb → rake4latex.rb} +5 -1
- data/bin/{readme_call_rake4latex.txt → readme_rake4latex.txt} +0 -0
- data/lib/rake4latex.rb +6 -8
- data/lib/rake4latex/base.rb +60 -15
- data/lib/rake4latex/clean.rb +37 -32
- data/lib/rake4latex/glossaries.rb +3 -4
- data/lib/rake4latex/latexrunner.rb +9 -4
- data/lib/rake4latex/rail.rb +80 -0
- data/lib/rake4latex/rules.rb +25 -56
- data/lib/rake4latex/splitindex.rb +7 -7
- data/lib/rake4latex_dtx.rb +6 -4
- data/lib/rake4latex_dvipdfm.rb +3 -10
- data/lib/rake4latex_ps2pdf.rb +4 -8
- data/readme.html +37 -12
- data/readme.txt +23 -8
- data/test/_expected/bibtex_test.txt +0 -1
- data/test/_expected/bibtex_test_bib.txt +0 -1
- data/test/_expected/bibtex_test_build_rakefile.txt +0 -1
- data/test/_expected/dtx_test.txt +0 -1
- data/test/_expected/dtx_test_sty.txt +0 -1
- data/test/_expected/dvipdfm_test.txt +0 -1
- data/test/_expected/error_test.txt +0 -1
- data/test/_expected/error_test_ignore_error.txt +0 -1
- data/test/_expected/error_test_overview.txt +11 -12
- data/test/_expected/error_test_statistic.txt +0 -1
- data/test/_expected/gloss_test.txt +0 -1
- data/test/_expected/gloss_test_bib.txt +0 -1
- data/test/_expected/gloss_test_build_rakefile.txt +0 -1
- data/test/_expected/glossaries_test.txt +0 -1
- data/test/_expected/includes_test.txt +0 -1
- data/test/_expected/includes_test_build_rakefile.txt +1 -2
- data/test/_expected/index_test.txt +0 -1
- data/test/_expected/longtable_test.txt +0 -1
- data/test/_expected/minitoc_test.txt +0 -1
- data/test/_expected/ps2pdf_test.txt +0 -1
- data/test/_expected/rail_error_test.txt +2 -3
- data/test/_expected/rail_test.txt +0 -1
- data/test/_expected/splitindex_test.txt +0 -1
- data/test/_expected/splitindex_test_build_rakefile.txt +0 -1
- data/test/_expected/supertabular_test.txt +0 -1
- data/test/_expected/supertabular_test_statistic.txt +1 -2
- data/test/_expected/two_tasks_test.txt +0 -1
- data/test/_expected/two_tasks_test_statistic.txt +0 -1
- data/test/_expected/varioref_test.txt +0 -1
- data/test/_expected/varioref_test_ignore_error.txt +1 -2
- data/test/_expected/z_complex_test.txt +0 -1
- data/test/_expected/z_complex_test_overview.txt +58 -58
- data/test/_expected/z_complex_test_overview_file.txt +0 -1
- data/test/_expected/z_complex_test_statistic.txt +0 -1
- data/test/bibtex/rakefile.rb +4 -9
- data/test/gloss/rakefile.rb +0 -7
- data/test/glossaries/rakefile.rb +4 -5
- data/test/rake4latex_testhelper.rb +76 -0
- data/test/test_extract.rb +29 -0
- data/test/unittest_rail.rb +154 -0
- data/test/unittest_rake4latex.rb +1 -0
- data/test/unittest_rake4latex_testcases.rb +96 -63
- data/test/unittest_splitindex.rb +14 -3
- metadata +89 -117
@@ -1,6 +1,5 @@
|
|
1
|
-
|
2
1
|
INFO LaTeXRunner: Clean: delete helpfiles ["testdocument.aux", "testdocument.log", "testdocument.out"]
|
3
|
-
INFO LaTeXRunner: Clobber: delete helpfiles ["testdocument.
|
2
|
+
INFO LaTeXRunner: Clobber: delete helpfiles ["testdocument.pdf"]
|
4
3
|
INFO testdocument: StartLaTeXRunner for testdocument.tex
|
5
4
|
INFO testdocument: Excute pdflatex -interaction=batchmode testdocument.tex
|
6
5
|
INFO testdocument: Rerun necessary (aux-file changed)
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
Log-overview for testdocument.tex
|
3
2
|
Document : 9 pages, 4 warnings (testdocument.log)
|
4
3
|
Bibliography: Used testdocument.bib, 3 warnings (testdocument.blg)
|
@@ -7,53 +6,53 @@ Log-overview for testdocument.tex
|
|
7
6
|
Index : 1 entry (testdocument-xxx.ilg)
|
8
7
|
Index : 2 entries (testdocument-fru.ilg)
|
9
8
|
Index : 3 entries (testdocument-idx.ilg)
|
10
|
-
---
|
11
|
-
testdocument.log:
|
12
|
-
:package_warnings:
|
13
|
-
minitoc(hints):
|
14
|
-
- W0030 [log#
|
15
|
-
- W0023 [log#
|
16
|
-
- W0039 [log#
|
17
|
-
- W0023 [log#
|
18
|
-
- W0024 [log#
|
19
|
-
:latex_warnings:
|
20
|
-
- No \author given. [log#
|
21
|
-
- Citation `irgendwas' on page 5 undefined on input line 57. [log#
|
22
|
-
- There were undefined references. [log#
|
23
|
-
:output:
|
24
|
-
- Output written on testdocument.pdf (9 pages) [log#
|
25
|
-
testdocument.blg:
|
26
|
-
:source_information:
|
9
|
+
---
|
10
|
+
testdocument.log:
|
11
|
+
:package_warnings:
|
12
|
+
minitoc(hints):
|
13
|
+
- W0030 [log#370]
|
14
|
+
- W0023 [log#375]
|
15
|
+
- W0039 [log#380]
|
16
|
+
- W0023 [log#385]
|
17
|
+
- W0024 [log#447]
|
18
|
+
:latex_warnings:
|
19
|
+
- No \author given. [log#394]
|
20
|
+
- Citation `irgendwas' on page 5 undefined on input line 57. [log#426]
|
21
|
+
- There were undefined references. [log#462]
|
22
|
+
:output:
|
23
|
+
- Output written on testdocument.pdf (9 pages) [log#480]
|
24
|
+
testdocument.blg:
|
25
|
+
:source_information:
|
27
26
|
- Database file testdocument.bib used
|
28
|
-
:warnings:
|
27
|
+
:warnings:
|
29
28
|
- string name "dtk" is undefined
|
30
29
|
- Databaseentry irgendwas missing
|
31
30
|
- empty journal in dtk00.4:lickert:blindtext
|
32
|
-
testdocument-ani.ilg:
|
33
|
-
:source_information:
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
37
|
-
testdocument-fru.ilg:
|
38
|
-
:source_information:
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
42
|
-
testdocument-idx.ilg:
|
43
|
-
:source_information:
|
44
|
-
-
|
45
|
-
-
|
46
|
-
-
|
47
|
-
testdocument-veg.ilg:
|
48
|
-
:source_information:
|
49
|
-
-
|
50
|
-
-
|
51
|
-
-
|
52
|
-
testdocument-xxx.ilg:
|
53
|
-
:source_information:
|
54
|
-
-
|
55
|
-
-
|
56
|
-
-
|
31
|
+
testdocument-ani.ilg:
|
32
|
+
:source_information:
|
33
|
+
- ! 'Input file: testdocument-ani.idx.'
|
34
|
+
- ! 'Entries accepted: 1'
|
35
|
+
- ! 'Entries rejected: 0'
|
36
|
+
testdocument-fru.ilg:
|
37
|
+
:source_information:
|
38
|
+
- ! 'Input file: testdocument-fru.idx.'
|
39
|
+
- ! 'Entries accepted: 2'
|
40
|
+
- ! 'Entries rejected: 0'
|
41
|
+
testdocument-idx.ilg:
|
42
|
+
:source_information:
|
43
|
+
- ! 'Input file: testdocument-idx.idx.'
|
44
|
+
- ! 'Entries accepted: 3'
|
45
|
+
- ! 'Entries rejected: 0'
|
46
|
+
testdocument-veg.ilg:
|
47
|
+
:source_information:
|
48
|
+
- ! 'Input file: testdocument-veg.idx.'
|
49
|
+
- ! 'Entries accepted: 1'
|
50
|
+
- ! 'Entries rejected: 0'
|
51
|
+
testdocument-xxx.ilg:
|
52
|
+
:source_information:
|
53
|
+
- ! 'Input file: testdocument-xxx.idx.'
|
54
|
+
- ! 'Entries accepted: 1'
|
55
|
+
- ! 'Entries rejected: 0'
|
57
56
|
|
58
57
|
========
|
59
58
|
Detailed analyse of testdocument.log
|
@@ -61,17 +60,18 @@ testdocument-xxx.ilg:
|
|
61
60
|
###########
|
62
61
|
##The following list may contain wrong line assignments
|
63
62
|
###########
|
64
|
-
---
|
65
|
-
:output:
|
66
|
-
- Output written on testdocument.pdf (9 pages) [page0] [log#
|
67
|
-
:package_warnings:
|
68
|
-
minitoc(hints):
|
69
|
-
- W0030 (./testdocument.tex) [log#
|
70
|
-
- W0023 (./testdocument.tex) [log#
|
71
|
-
- W0039 (./testdocument.tex) [log#
|
72
|
-
- W0023 (./testdocument.tex) [log#
|
73
|
-
- W0024 (./testdocument.tex) [log#
|
74
|
-
:latex_warnings:
|
75
|
-
- No \author given. (./testdocument.tex) [log#
|
76
|
-
- Citation `irgendwas' on page 5 undefined on input line 57. (./testdocument.tex)
|
77
|
-
|
63
|
+
---
|
64
|
+
:output:
|
65
|
+
- Output written on testdocument.pdf (9 pages) [page0] [log#22] - []
|
66
|
+
:package_warnings:
|
67
|
+
minitoc(hints):
|
68
|
+
- W0030 (./testdocument.tex) [log#97] - []
|
69
|
+
- W0023 (./testdocument.tex) [log#102] - []
|
70
|
+
- W0039 (./testdocument.tex) [log#107] - []
|
71
|
+
- W0023 (./testdocument.tex) [log#112] - []
|
72
|
+
- W0024 (./testdocument.tex) [log#159] - []
|
73
|
+
:latex_warnings:
|
74
|
+
- No \author given. (./testdocument.tex) [log#121] - []
|
75
|
+
- Citation `irgendwas' on page 5 undefined on input line 57. (./testdocument.tex)
|
76
|
+
[log#146] - []
|
77
|
+
- There were undefined references. (./testdocument.tex) [log#174] - []
|
data/test/bibtex/rakefile.rb
CHANGED
@@ -59,15 +59,10 @@ if $0 == __FILE__
|
|
59
59
|
app = Rake.application
|
60
60
|
#~ Rake4LaTeX.set_latexrunner_default(:maxruns, 1)
|
61
61
|
#~ Rake4LaTeX.set_latexrunner_default(:loglevel, Log4r::DEBUG)
|
62
|
-
app[:default].invoke
|
62
|
+
#~ app[:default].invoke
|
63
63
|
|
64
|
-
#~ app[:
|
64
|
+
#~ app[:clobber].invoke
|
65
|
+
#~ app[:test].invoke
|
66
|
+
#~ app[:test_bib].invoke
|
65
67
|
|
66
|
-
#Simulate the unit test and build expected
|
67
|
-
#~ [ :test, :test_bib, :clean ].each{|testcase|
|
68
|
-
#~ stdout, stderr = catch_screen_output{
|
69
|
-
#~ app[testcase].invoke
|
70
|
-
#~ }
|
71
|
-
#~ File.open("#{File.basename(Dir.pwd)}_#{testcase}.txt", 'w'){ |f| f << stdout }
|
72
|
-
#~ }
|
73
68
|
end
|
data/test/gloss/rakefile.rb
CHANGED
@@ -64,11 +64,4 @@ if $0 == __FILE__
|
|
64
64
|
|
65
65
|
#~ app[:clean].invoke
|
66
66
|
|
67
|
-
#Simulate the unit test and build expected
|
68
|
-
#~ [ :test, :test_bib, :clean ].each{|testcase|
|
69
|
-
#~ stdout, stderr = catch_screen_output{
|
70
|
-
#~ app[testcase].invoke
|
71
|
-
#~ }
|
72
|
-
#~ File.open("#{File.basename(Dir.pwd)}_#{testcase}.txt", 'w'){ |f| f << stdout }
|
73
|
-
#~ }
|
74
67
|
end
|
data/test/glossaries/rakefile.rb
CHANGED
@@ -2,11 +2,10 @@
|
|
2
2
|
#Test Glossaries
|
3
3
|
#http://theoval.cmp.uea.ac.uk/~nlct/latex/packages/glossaries/glossaries-manual.html
|
4
4
|
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
#~ require 'glossaries'
|
5
|
+
|
6
|
+
$:.unshift('../../lib')
|
7
|
+
require 'rake4latex'
|
8
|
+
require 'rake4latex/glossaries'
|
10
9
|
|
11
10
|
|
12
11
|
deps = [
|
@@ -0,0 +1,76 @@
|
|
1
|
+
=begin rdoc
|
2
|
+
=end
|
3
|
+
gem 'more_unit_test', '> 0.0.2'
|
4
|
+
require 'more_unit_test/assert_equal_filecontent'
|
5
|
+
|
6
|
+
=begin rdoc
|
7
|
+
Generic test definition for testcases.
|
8
|
+
=end
|
9
|
+
module Rake4latex_testhelper
|
10
|
+
=begin rdoc
|
11
|
+
Test testcase(s).
|
12
|
+
|
13
|
+
Example:
|
14
|
+
class Test_testdocument < Test::Unit::TestCase
|
15
|
+
include Rake4latex_testhelper
|
16
|
+
#run testcase in directory 'splitindex'
|
17
|
+
def test_splitindex
|
18
|
+
mytest_testcase( 'splitindex')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
1) Changes to test directory and look for a rakefile.rb.
|
23
|
+
2) Scan rakefile.rb for basefile
|
24
|
+
3) Scan rakefile.rb for task :test____ and call rake for it
|
25
|
+
4) Compare output with expected result
|
26
|
+
|
27
|
+
=end
|
28
|
+
def define_testcase( dir )
|
29
|
+
assert_equal( true, File.directory?(dir))
|
30
|
+
|
31
|
+
Dir.chdir(dir){
|
32
|
+
assert_equal( true, File.exist?('rakefile.rb'), "No rakefile in #{dir}")
|
33
|
+
#clean and check if test directory is empty in advance.
|
34
|
+
`call rake clobber`
|
35
|
+
assert_equal( true, Dir['*.{aux,log}'].empty?, "<#{dir}> contains old testdata")
|
36
|
+
|
37
|
+
#Logger umh�ngen auf file
|
38
|
+
#~ LaTeXRunner.logger.outputters = Log4r::FileOutputter.new("#{dir}.log4r")
|
39
|
+
LaTeXRunner::DEFAULT_SETTINGS[:loglevel] = Log4r::INFO
|
40
|
+
#testcases: test (test1 test2 ...)
|
41
|
+
testcase = nil
|
42
|
+
File.open('rakefile.rb'){|rakefile|
|
43
|
+
rakefile_content = rakefile.read
|
44
|
+
assert_match(/^\s*task\s*:basefile\s*=>|Rake4LaTeX::Basefile.set/, rakefile_content, "Missing basefile-task in Test #{dir}")
|
45
|
+
#Get all test cases
|
46
|
+
rakefile_content.scan(/^task\s*:(test\S*)\s*=>(.*)$/){|hit|
|
47
|
+
testcase = hit.first
|
48
|
+
dircontent = Dir['*'] #Remember the directory content before the task
|
49
|
+
result = `call rake #{testcase}`
|
50
|
+
result.sub!(/\(in .*?$/,'') #delete first line from rake (depends on directory the test runs).
|
51
|
+
result.sub!(/^call (.*?)\n$/,'') if RUBY_VERSION =~ /1.9/
|
52
|
+
|
53
|
+
#Take a look on the prerequisites
|
54
|
+
case hit[1]
|
55
|
+
#Special test with :log_overview.
|
56
|
+
#Don't test stdout, but content of the overview-file
|
57
|
+
when /:log_overview_file/
|
58
|
+
assert_equal( 1, Dir['*'].size - dircontent.size , 'No log-overview created' ) #One file created
|
59
|
+
end
|
60
|
+
self.folder_for_failure = "../_failure#{Date.today}"
|
61
|
+
assert_equal_filecontent( "../_expected/#{dir}_#{testcase}.txt", result,
|
62
|
+
"Testcase #{dir}/#{testcase} changed content"
|
63
|
+
)
|
64
|
+
}#loop on test-tasks
|
65
|
+
}#File rakefile
|
66
|
+
assert_not_nil(testcase, "No testcase found in <#{dir}>")
|
67
|
+
|
68
|
+
#Check overview file
|
69
|
+
#~
|
70
|
+
#~ `call rake log_overview`
|
71
|
+
|
72
|
+
#~ `call rake clean`
|
73
|
+
`call rake clobber` #PDFs not really needed after the test.
|
74
|
+
}
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
=begin
|
2
|
+
How to run individual Ruby Test::Unit tests
|
3
|
+
http://www.natontesting.com/2009/08/03/how-to-run-individual-ruby-testunit-tests/
|
4
|
+
|
5
|
+
|
6
|
+
=end
|
7
|
+
gem 'test-unit'
|
8
|
+
#relevant test::unit requires
|
9
|
+
require 'test/unit'
|
10
|
+
require 'test/unit/ui/console/testrunner'
|
11
|
+
|
12
|
+
#TestCase classes that contain the methods I want to execute
|
13
|
+
require './unittest_rake4latex_testcases'
|
14
|
+
|
15
|
+
#create a new empty TestSuite, giving it a name
|
16
|
+
my_tests = Test::Unit::TestSuite.new("My Special Tests")
|
17
|
+
|
18
|
+
#add the test method called 'test_one' defined
|
19
|
+
#in the TestOne TestCase class to the my_tests
|
20
|
+
#test suite defined above
|
21
|
+
#~ my_tests << Test_testdocument.new('test_error')
|
22
|
+
#~ my_tests << Test_testdocument.new('test_two_tasks')
|
23
|
+
#~ my_tests << Test_testdocument.new('test_bibtex')
|
24
|
+
#~ my_tests << Test_testdocument.new('test_gloss')
|
25
|
+
#~ my_tests << Test_testdocument.new('test_minitoc')
|
26
|
+
|
27
|
+
|
28
|
+
#run the suite
|
29
|
+
Test::Unit::UI::Console::TestRunner.run(my_tests)
|
@@ -0,0 +1,154 @@
|
|
1
|
+
gem 'test-unit'
|
2
|
+
gem 'test-unit', '<= 2.1.1' if RUBY_VERSION == '1.9.1'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
=begin
|
6
|
+
The original rail.exe is a 16bit version and works not
|
7
|
+
with Windows 64bit.
|
8
|
+
|
9
|
+
The compilation is no problem:
|
10
|
+
|
11
|
+
1. Get rail source from http://ctan.org/tex-archive/support/rail
|
12
|
+
2. You need devkit-tools (make, yacc...)
|
13
|
+
To use the ruby devkit:
|
14
|
+
PATH=%PATH%;C:\bin\devkit\mingw\bin;C:\bin\devkit\bin
|
15
|
+
make
|
16
|
+
=end
|
17
|
+
|
18
|
+
#~ require 'assert_equal_filecontent'
|
19
|
+
if $0 == __FILE__
|
20
|
+
$:.unshift('../lib')
|
21
|
+
else
|
22
|
+
#Change the directory. Relevant, if called from rakefile_rake4latex.rb
|
23
|
+
Dir.chdir(File.dirname(__FILE__))
|
24
|
+
end
|
25
|
+
require 'rake4latex'
|
26
|
+
include Rake4LaTeX
|
27
|
+
require_relative('rake4latex_testhelper')
|
28
|
+
|
29
|
+
class Test_rail < Test::Unit::TestCase
|
30
|
+
def test_rail_available
|
31
|
+
found = false
|
32
|
+
ENV['Path'].split(/;/).each{|path|
|
33
|
+
next if path.empty?
|
34
|
+
Dir.chdir(path){
|
35
|
+
found = true if File.exist?( 'rail.exe' )
|
36
|
+
} rescue Errno::ENOENT
|
37
|
+
break if found
|
38
|
+
}
|
39
|
+
assert_true(found, 'Rail.exe not found in search path')
|
40
|
+
end
|
41
|
+
def test_correct_programm
|
42
|
+
stdin, stdout, stderr, wait_thr = Open3.popen3('rail.exe xxx')
|
43
|
+
assert_true(wait_thr.value.exited?) #Process::Status
|
44
|
+
assert_false(wait_thr.value.success?) #Process::Status
|
45
|
+
assert_equal(1, wait_thr.value.exitstatus ) #Process::Status
|
46
|
+
#~ assert_equal([%{This is Rail, Version 1.0 #0\n}], stdout.readlines) #Win32
|
47
|
+
assert_equal([%{This is Rail, Version 1.2 #1\n}], stdout.readlines)
|
48
|
+
assert_equal([%{xxx.rai: No such file or directory\n}], stderr.readlines)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class Test_rail_ok < Test::Unit::TestCase
|
53
|
+
def self.startup
|
54
|
+
@@testrai_file = '_tmp_.rai'
|
55
|
+
@@delete_at_teardown = [@@testrai_file]
|
56
|
+
File.open(@@testrai_file, 'w'){|f|
|
57
|
+
f << "\\rail@i{1}{ block1 : ( lbrace | 'begin' ) ( ( '|' ( variable + ',' ) '|' ) | [Keine Blockvariablen] ) comm ( rbrace | 'end' ) ; }"
|
58
|
+
}
|
59
|
+
end
|
60
|
+
def self.shutdown
|
61
|
+
@@delete_at_teardown.each{|filename|
|
62
|
+
(File.delete(filename) if File.exist?(filename)) rescue Errno::EACCES
|
63
|
+
}
|
64
|
+
end
|
65
|
+
def setup
|
66
|
+
@rail = Rake4LaTeX::Rail.new(@@testrai_file)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_rail_cmd
|
70
|
+
assert_equal("rail.exe < #{@@testrai_file}", @rail.cmd)
|
71
|
+
end
|
72
|
+
def test_rail_cmd_execution
|
73
|
+
expected = <<'expect'
|
74
|
+
\rail@i {1}{ block1 : ( lbrace | 'begin' ) ( ( '|' ( variable + ',' ) '|' ) | [Keine Blockvariablen] ) comm ( rbrace | 'end' ) ; }
|
75
|
+
\rail@o {1}{
|
76
|
+
\rail@begin{3}{block1}
|
77
|
+
\rail@bar
|
78
|
+
\rail@nont{lbrace}[]
|
79
|
+
\rail@nextbar{1}
|
80
|
+
\rail@term{begin}[]
|
81
|
+
\rail@endbar
|
82
|
+
\rail@bar
|
83
|
+
\rail@term{|}[]
|
84
|
+
\rail@plus
|
85
|
+
\rail@nont{variable}[]
|
86
|
+
\rail@nextplus{1}
|
87
|
+
\rail@cterm{,}[]
|
88
|
+
\rail@endplus
|
89
|
+
\rail@term{|}[]
|
90
|
+
\rail@nextbar{2}
|
91
|
+
\rail@annote[Keine Blockvariablen]
|
92
|
+
\rail@endbar
|
93
|
+
\rail@nont{comm}[]
|
94
|
+
\rail@bar
|
95
|
+
\rail@nont{rbrace}[]
|
96
|
+
\rail@nextbar{1}
|
97
|
+
\rail@term{end}[]
|
98
|
+
\rail@endbar
|
99
|
+
\rail@end
|
100
|
+
}
|
101
|
+
expect
|
102
|
+
|
103
|
+
assert_true( @rail.execute )
|
104
|
+
assert_equal(expected.strip,@rail.stdout)
|
105
|
+
assert_equal('', @rail.stderr)
|
106
|
+
end
|
107
|
+
end #Test_Rail_ok
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
class Test_rail_error < Test::Unit::TestCase
|
112
|
+
def self.startup
|
113
|
+
@@testrai_file = '_tmp_.rai'
|
114
|
+
@@delete_at_teardown = [@@testrai_file]
|
115
|
+
File.open(@@testrai_file, 'w'){|f|
|
116
|
+
#rail-definition with error
|
117
|
+
f << "\rail@i{1}{ block1 : ( "
|
118
|
+
}
|
119
|
+
end
|
120
|
+
def self.shutdown
|
121
|
+
@@delete_at_teardown.each{|filename|
|
122
|
+
(File.delete(filename) if File.exist?(filename)) rescue Errno::EACCES
|
123
|
+
}
|
124
|
+
end
|
125
|
+
def setup
|
126
|
+
@rail = Rake4LaTeX::Rail.new(@@testrai_file)
|
127
|
+
end
|
128
|
+
def test_rail_cmd
|
129
|
+
assert_equal("rail.exe < #{@@testrai_file}", @rail.cmd)
|
130
|
+
end
|
131
|
+
def test_rail_cmd_execution
|
132
|
+
assert_false( @rail.execute )
|
133
|
+
assert_equal("",@rail.stdout.strip)
|
134
|
+
assert_equal(%{stdin, line 1: syntax error\n}, @rail.stderr)
|
135
|
+
end
|
136
|
+
end #Test_Rail_error
|
137
|
+
|
138
|
+
|
139
|
+
class Test_rail_testcases < Test::Unit::TestCase
|
140
|
+
include Rake4latex_testhelper #get define_testcase
|
141
|
+
|
142
|
+
def test_testdirectories()
|
143
|
+
assert_true(Dir.exist?('rail'))
|
144
|
+
assert_true(Dir.exist?('rail_error'))
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_rail
|
148
|
+
define_testcase( 'rail')
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_rail_error
|
152
|
+
define_testcase( 'rail_error')
|
153
|
+
end
|
154
|
+
end
|