[gjs] tests: Add new installed-tests/scripts test mechanism



commit 8cbd17ab119d9123d870fb433f548883df51279a
Author: Colin Walters <walters verbum org>
Date:   Fri Jul 26 01:25:29 2013 +0100

    tests: Add new installed-tests/scripts test mechanism
    
    The unit tests are not suitable for all sorts of tests; in particular,
    I can't test System.exit() from there since it loads all of the
    tests into one process.
    
    So this patch adds a new type of "scripts" test which is literally
    just a gjs script; if it exits successfully, the test passed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=703826

 Makefile-insttest.am                      |    7 +++++++
 installed-tests/script.test.in            |    3 +++
 installed-tests/scripts/testSystemExit.js |    5 +++++
 3 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/Makefile-insttest.am b/Makefile-insttest.am
index eb80052..08af5ad 100644
--- a/Makefile-insttest.am
+++ b/Makefile-insttest.am
@@ -115,4 +115,11 @@ dist_jstests_DATA += \
 if ENABLE_CAIRO
 dist_jstests_DATA += installed-tests/js/testCairo.js
 endif
+
+%.test: installed-tests/scripts/%.js installed-tests/script.test.in Makefile
+       sed -e s,@pkglibexecdir\@,$(pkglibexecdir), -e s,@name\@,$(notdir $<), < 
$(srcdir)/installed-tests/script.test.in > $  tmp && mv $  tmp $@
+
+jsscripttestsdir = $(gjsinsttestdir)/scripts
+jsscripttests_DATA = installed-tests/scripts/testSystemExit.js
+installedtestmeta_DATA += testSystemExit.test
 endif
diff --git a/installed-tests/script.test.in b/installed-tests/script.test.in
new file mode 100644
index 0000000..7fa8a99
--- /dev/null
+++ b/installed-tests/script.test.in
@@ -0,0 +1,3 @@
+[Test]
+Type=session
+Exec=gjs @pkglibexecdir@/installed-tests/scripts/@name@
diff --git a/installed-tests/scripts/testSystemExit.js b/installed-tests/scripts/testSystemExit.js
new file mode 100644
index 0000000..68743aa
--- /dev/null
+++ b/installed-tests/scripts/testSystemExit.js
@@ -0,0 +1,5 @@
+// application/javascript;version=1.8
+
+const System = imports.system;
+
+System.exit(0);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]