summaryrefslogtreecommitdiff
path: root/installed-tests
diff options
context:
space:
mode:
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2022-06-09 04:14:33 +0200
committerPhilip Chimento <philip.chimento@gmail.com>2022-11-02 21:44:48 -0700
commit78a8bcaefc2275b45e1ef4b3141c8c5a12798b90 (patch)
tree61fda6c4a8de70928f95198ebac2e594cf5cec8c /installed-tests
parente829319e48eba83fcff21baafabad2361e81b7fa (diff)
downloadgjs-78a8bcaefc2275b45e1ef4b3141c8c5a12798b90.tar.gz
testConsole: Test that console.assert works as expected
Diffstat (limited to 'installed-tests')
-rw-r--r--installed-tests/js/testConsole.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/installed-tests/js/testConsole.js b/installed-tests/js/testConsole.js
index 2e699fff..c999e9f3 100644
--- a/installed-tests/js/testConsole.js
+++ b/installed-tests/js/testConsole.js
@@ -177,6 +177,29 @@ describe('console', function () {
writer_func.calls.reset();
});
+ it('asserts a true condition', function () {
+ console.assert(true, 'no printed');
+ expect(writer_func).not.toHaveBeenCalled();
+
+ writer_func.calls.reset();
+ });
+
+ it('asserts a false condition', function () {
+ console.assert(false);
+
+ expectLog('Assertion failed', GLib.LogLevelFlags.LEVEL_CRITICAL);
+
+ writer_func.calls.reset();
+ });
+
+ it('asserts a false condition with message', function () {
+ console.assert(false, 'asserts false is not true');
+
+ expectLog('asserts false is not true', GLib.LogLevelFlags.LEVEL_CRITICAL);
+
+ writer_func.calls.reset();
+ });
+
describe('clear()', function () {
it('can be called', function () {
console.clear();