From ea33f599fc2b935fe14ee459bad2b6568ccbeef8 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sat, 9 Apr 2022 06:10:39 +0000 Subject: [PATCH] touched up t/h-003.hawk --- hawk/t/bibtex-to-html.hawk | 5 +++-- hawk/t/h-003.hawk | 14 +++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/hawk/t/bibtex-to-html.hawk b/hawk/t/bibtex-to-html.hawk index 05eafd30..79394f34 100644 --- a/hawk/t/bibtex-to-html.hawk +++ b/hawk/t/bibtex-to-html.hawk @@ -494,8 +494,9 @@ function do_line( n,name,s) function output_filename(input_filename) { -## HAWK - for use in t/h-003.hawk -return length(OUTPUT_FILENAME) > 0? OUTPUT_FILENAME: "/dev/stdout"; + ## HAWK - for use in t/h-003.hawk + if (length(T_OUT_NAME) > 0) return T_OUT_NAME; + ## END HAWK 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 6a665ae7..1741ad32 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, redir, out_name) +function run_test (x, more_opts, in_name, set_out_name, out_name) { @local cmd, inf, expf, outf, same; @@ -51,13 +51,13 @@ function run_test (x, more_opts, in_name, redir, out_name) outf = sprintf("/tmp/%s.%d.out", out_name, sys::getpid()); ##print TDIR, inf, expf, outf; - if (redir) + if (set_out_name) { - cmd=sprintf("%s %s -f %s/%s.hawk --modlibdirs=%s %s > %s", ARGV[0], more_opts, TDIR, x, hawk::modlibdirs(), inf, outf); + cmd=sprintf("%s %s -vT_OUT_NAME=%s -f %s/%s.hawk --modlibdirs=%s %s", ARGV[0], more_opts, outf, TDIR, x, hawk::modlibdirs(), inf); } 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); + cmd=sprintf("%s %s -f %s/%s.hawk --modlibdirs=%s %s > %s", ARGV[0], more_opts, TDIR, x, hawk::modlibdirs(), inf, outf); } ##print cmd; system (cmd); @@ -77,9 +77,9 @@ function run_test (x, more_opts, in_name, redir, out_name) function main() { - 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"); + run_test ("journal-toc", "", @nil, 0, @nil); + run_test ("journal-toc", "-vHTML=1", "journal-toc", 0, "journal-toc-html"); + run_test ("bibtex-to-html", "", "journal-toc", 1, "bibtex-to-html"); tap_end (); }