From f3004620036acf10a3137d2727fd6f948b14193c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 11 Jun 2015 14:21:53 +0200 Subject: [PATCH] tests: Remove format test The format() function was moved to gjs a long time ago. --- tests/Makefile.am | 1 - tests/unit/format.js | 36 ------------------------------------ 2 files changed, 37 deletions(-) delete mode 100644 tests/unit/format.js diff --git a/tests/Makefile.am b/tests/Makefile.am index beecb4634..22ef81d30 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -26,7 +26,6 @@ TEST_JS = \ testcommon/border-image.png \ testcommon/face-plain.png \ testcommon/ui.js \ - unit/format.js \ unit/insertSorted.js \ unit/markup.js \ unit/jsParse.js \ diff --git a/tests/unit/format.js b/tests/unit/format.js deleted file mode 100644 index d1064d07b..000000000 --- a/tests/unit/format.js +++ /dev/null @@ -1,36 +0,0 @@ -// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- - -/* - * Test cases for the Format module - */ - -const JsUnit = imports.jsUnit; -const assertEquals = JsUnit.assertEquals; -const assertRaises = JsUnit.assertRaises; - -// We can't depend on environment.js to set up the String.prototype.format, -// because the tests run in one JS context, and the imports run in the GJS -// "load context" which has its own copy of the String class -const Format = imports.misc.format; -String.prototype.format = Format.format; - -// Test common usage and %% handling -assertEquals("foo", "%s".format('foo')); -assertEquals("%s", "%%s".format('foo')); -assertEquals("%%s", "%%%%s".format('foo')); -assertEquals("foo 5", "%s %d".format('foo', 5)); -assertEquals("8", "%d".format(8)); -assertEquals("f", "%x".format(15)); -assertEquals("2.58 6.96", "%f %.2f".format(2.58, 6.958)); - -// Test field width -assertEquals("007 foo", "%03d %4s".format(7, 'foo')); -assertEquals(" 2.58 06.96", "%5f %05.2f".format(2.58, 6.958)); -assertEquals("cafe", "%2x".format(0xcafe)); -assertEquals("foo", "%0s".format('foo')); - -// Precision is only allowed for %f -assertRaises(function() { "%.2d".format(5.21) }); - -// Wrong conversion character ' ' -assertRaises( function() { "%s is 50% done".format('foo') });