geary/test/client/util/util-js-test.vala
Michael Gratton da6ac828bd Move Geary.JS package into client as Util.JS
The only reason it was in the engine was so it could be used by both
the client and the web extension, without worrying about the
webkit2gtk and webkit2gtk_web_extension packages conflicting. However
it didn't really belong there, and added a dependency for the engine
on javascriptcoregtk which doesn't belong. So this fixes all that.
2019-07-21 10:00:32 +10:00

24 lines
772 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 Util.JS.Test : TestCase {
public Test() {
base("Util.JS.Test");
add_test("escape_string", escape_string);
}
public void escape_string() throws Error {
assert(Util.JS.escape_string("\n") == """\n""");
assert(Util.JS.escape_string("\r") == """\r""");
assert(Util.JS.escape_string("\t") == """\t""");
assert(Util.JS.escape_string("\'") == """\'""");
assert(Util.JS.escape_string("\"") == """\"""");
assert(Util.JS.escape_string("something…\n") == """something…\n""");
}
}