geary/test/engine/util-js-test.vala
Michael James Gratton 15748cef03 Tidy up unit test infrastructure and mock classes.
* test/api/*.vala: Renamed files that contained mock objects to *-mock.vala,
  not *-test.vala.

* test/testcase.vala: Renamed to test-case.vala for consistency, remove
  TestCase class from Gee package since that's really not true. Clean up
  code for consistency.

* test/meson.build, test/CMakeLists.txt: Split TestCase compilation out
  into a separate test lib.
2018-04-07 09:41:18 +10:00

24 lines
780 B
Vala

/*
* Copyright 2017 Michael Gratton <mike@vee.net>
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
*/
public class Geary.JS.Test : TestCase {
public Test() {
base("Geary.JS.Test");
add_test("escape_string", escape_string);
}
public void escape_string() throws Error {
assert(Geary.JS.escape_string("\n") == """\n""");
assert(Geary.JS.escape_string("\r") == """\r""");
assert(Geary.JS.escape_string("\t") == """\t""");
assert(Geary.JS.escape_string("\'") == """\'""");
assert(Geary.JS.escape_string("\"") == """\"""");
assert(Geary.JS.escape_string("something…\n") == """something…\n""");
}
}