extended t/bibtex-to-html.hawk to work on plaforms without /dev/stdXXX

This commit is contained in:
hyung-hwan 2022-04-09 02:44:36 +00:00
parent 0ccb633682
commit 4079fb4047
2 changed files with 14 additions and 6 deletions

View File

@ -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

View File

@ -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 ();
}