path: root/tests
diff options
authorOswald Buddenhagen <>2012-04-27 14:01:08 +0200
committerOswald Buddenhagen <>2012-06-19 16:39:54 +0200
commit84614cabfaaab5eb4be04688a84cef8d79493f75 (patch)
tree9aac33e1a42d498aa71a8da490116f37c55fc4fe /tests
parent2702f7637e7a2955d37dcd8e748dbf3faf477b2d (diff)
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 <>
Diffstat (limited to 'tests')
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/auto/tools/qmake/testdata/functions/ b/tests/auto/tools/qmake/testdata/functions/
index ad66ee863d..1da7fd923b 100644
--- a/tests/auto/tools/qmake/testdata/functions/
+++ b/tests/auto/tools/qmake/testdata/functions/
@@ -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")