comparison tests/js-system/main.cpp @ 0:1158cffe5a5e

Initial import
author David Demelier <markand@malikania.fr>
date Mon, 08 Feb 2016 16:43:14 +0100
parents
children f8160d515a76
comparison
equal deleted inserted replaced
-1:000000000000 0:1158cffe5a5e
1 /*
2 * main.cpp -- test Irccd.System API
3 *
4 * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #include <gtest/gtest.h>
20
21 #include <system.h>
22
23 #include <js-irccd.h>
24 #include <js-system.h>
25
26 using namespace irccd;
27
28 TEST(TestJsSystem, home)
29 {
30 js::Context ctx;
31
32 loadJsIrccd(ctx);
33 loadJsSystem(ctx);
34
35 try {
36 ctx.peval(js::Script{"result = Irccd.System.home();"});
37
38 ASSERT_EQ(sys::home(), ctx.getGlobal<std::string>("result"));
39 } catch (const std::exception &ex) {
40 FAIL() << ex.what();
41 }
42 }
43
44 int main(int argc, char **argv)
45 {
46 testing::InitGoogleTest(&argc, argv);
47
48 return RUN_ALL_TESTS();
49 }