diff --git a/hawk/t/bibtex-to-html.hawk b/hawk/t/bibtex-to-html.hawk index 5401fab6..05eafd30 100644 --- a/hawk/t/bibtex-to-html.hawk +++ b/hawk/t/bibtex-to-html.hawk @@ -495,7 +495,7 @@ function do_line( n,name,s) function output_filename(input_filename) { ## HAWK - for use in t/h-003.hawk -return "/dev/stdout"; +return length(OUTPUT_FILENAME) > 0? OUTPUT_FILENAME: "/dev/stdout"; if (input_filename != _last_input_filename) { # optimization: we cache last function result for speed diff --git a/hawk/t/h-003.hawk b/hawk/t/h-003.hawk index 440c9c05..6a665ae7 100644 --- a/hawk/t/h-003.hawk +++ b/hawk/t/h-003.hawk @@ -39,7 +39,7 @@ function are_files_identical(a, b) return !diff; } -function run_test (x, more_opts, in_name, out_name) +function run_test (x, more_opts, in_name, redir, out_name) { @local cmd, inf, expf, outf, same; @@ -51,7 +51,14 @@ function run_test (x, more_opts, in_name, out_name) outf = sprintf("/tmp/%s.%d.out", out_name, sys::getpid()); ##print TDIR, inf, expf, outf; - cmd=sprintf("%s %s -f %s/%s.hawk --modlibdirs=%s %s > %s", ARGV[0], more_opts, TDIR, x, hawk::modlibdirs(), inf, outf); + if (redir) + { + cmd=sprintf("%s %s -f %s/%s.hawk --modlibdirs=%s %s > %s", ARGV[0], more_opts, TDIR, x, hawk::modlibdirs(), inf, outf); + } + else + { + cmd=sprintf("%s %s -vOUTPUT_FILENAME=%s -f %s/%s.hawk --modlibdirs=%s %s", ARGV[0], more_opts, outf, TDIR, x, hawk::modlibdirs(), inf); + } ##print cmd; system (cmd); @@ -70,9 +77,10 @@ function run_test (x, more_opts, in_name, out_name) function main() { - run_test ("journal-toc"); - run_test ("journal-toc", "-vHTML=1", "journal-toc", "journal-toc-html"); - run_test ("bibtex-to-html", "", "journal-toc", "bibtex-to-html"); + run_test ("journal-toc", "", @nil, 1, @nil); + run_test ("journal-toc", "-vHTML=1", "journal-toc", 1, "journal-toc-html"); + run_test ("bibtex-to-html", "", "journal-toc", 0, "bibtex-to-html"); + tap_end (); }