From 84614cabfaaab5eb4be04688a84cef8d79493f75 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 27 Apr 2012 14:01:08 +0200 Subject: add write_file() function this dumps the contents of a variable into a file. each element of the variable is considered a line; line terminators are added. all missing directories are automatically created. Change-Id: Idafeb873cea64e6705c894b3ab0ef21df69e7170 Reviewed-by: Marius Storm-Olsen --- tests/auto/tools/qmake/testdata/functions/functions.pro | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/tools/qmake/testdata/functions/functions.pro b/tests/auto/tools/qmake/testdata/functions/functions.pro index ad66ee863d..1da7fd923b 100644 --- a/tests/auto/tools/qmake/testdata/functions/functions.pro +++ b/tests/auto/tools/qmake/testdata/functions/functions.pro @@ -84,4 +84,18 @@ myTestFunction("oink baa moo") message("FAILED: myTestFunction: $$RESULT") } - +moo = "this is a test" "for real" +fn = $$OUT_PWD/testdir/afile +write_file($$fn, moo)|message("FAILED: write_file() failed") +exists($$fn)|message("FAILED: write_file() didn't write anything") +mooout = $$cat($$fn, line) +equals(moo, $$mooout)|message("FAILED: write_file() wrote something wrong") +moo += "another line" +write_file($$fn, moo)|message("FAILED: write_file() failed (take 2)") +mooout = $$cat($$fn, line) +equals(moo, $$mooout)|message("FAILED: write_file() wrote something wrong (take 2)") +mooadd = "yet another line" +write_file($$fn, mooadd, append)|message("FAILED: write_file() failed (append)") +moo += $$mooadd +mooout = $$cat($$fn, line) +equals(moo, $$mooout)|message("FAILED: write_file() wrote something wrong when appending") -- cgit v1.2.3