# # # patch "testlib.lua" # from [1699df3451bf8dce233fbcf20e305930f57c5863] # to [44d6be1881e02da1a2bb908a99f995f1d0af4830] # # patch "tests/syntax_errors_in_.mtn-ignore/__driver__.lua" # from [40ae692978a4b62a47ad35468cc2e52656a68643] # to [370e177545af48aa97d064961f5dd6610ba825f7] # # patch "tests/syntax_errors_in_.mtn-ignore/stderr-ref" # from [e5393b2dd883f02f0f5bbe8a97aec42304c69f0e] # to [6d982783b4455a358e195a462a8347cee1b41e83] # ============================================================ --- testlib.lua 1699df3451bf8dce233fbcf20e305930f57c5863 +++ testlib.lua 44d6be1881e02da1a2bb908a99f995f1d0af4830 @@ -166,6 +166,23 @@ end return readfile(testdir.."/"..filename) end +-- Return all but the first N lines of FILENAME. +-- Note that (unlike readfile()) the result will +-- end with a \n whether or not the file did. +function tailfile(filename, n) + L(locheader(), "tailfile ", filename, ", ", n, "\n") + local i = 1 + local t = {} + for l in io.lines(filename) do + if i > n then + table.insert(t, l) + end + i = i + 1 + end + table.insert(t, "") + return table.concat(t, "\n") +end + function writefile_q(filename, dat) local file,e if dat == nil then ============================================================ --- tests/syntax_errors_in_.mtn-ignore/__driver__.lua 40ae692978a4b62a47ad35468cc2e52656a68643 +++ tests/syntax_errors_in_.mtn-ignore/__driver__.lua 370e177545af48aa97d064961f5dd6610ba825f7 @@ -13,4 +13,5 @@ check(samefile("stdout", "stdout-ref")) check(get("stderr-ref")) check(samefile("stdout", "stdout-ref")) +-- the first line of stderr may vary from run to run +check(tailfile("stderr", 1) == readfile("stderr-ref")) -check(samefile("stderr", "stderr-ref")) ============================================================ --- tests/syntax_errors_in_.mtn-ignore/stderr-ref e5393b2dd883f02f0f5bbe8a97aec42304c69f0e +++ tests/syntax_errors_in_.mtn-ignore/stderr-ref 6d982783b4455a358e195a462a8347cee1b41e83 @@ -1,4 +1,3 @@ -mtn: warning: while matching file 'ts-stdin': .mtn-ignore:1: warning: error near char 2 of regex "\": \ at end of pattern - skipping this regex for all remaining files. .mtn-ignore:2: warning: error near char 3 of regex "\c": \c at end of pattern