Mercurial > irccd
comparison tests/js-system/main.cpp @ 75:f8160d515a76
Irccd: rework a lot the JavaScript library
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 30 Mar 2016 13:52:47 +0200 |
parents | 1158cffe5a5e |
children | 1125d90b3b44 |
comparison
equal
deleted
inserted
replaced
74:35ef15100de8 | 75:f8160d515a76 |
---|---|
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 */ | 17 */ |
18 | 18 |
19 #include <gtest/gtest.h> | 19 #include <gtest/gtest.h> |
20 | 20 |
21 #include <system.h> | 21 #include <irccd/js-irccd.h> |
22 | 22 #include <irccd/js-system.h> |
23 #include <js-irccd.h> | 23 #include <irccd/system.h> |
24 #include <js-system.h> | |
25 | 24 |
26 using namespace irccd; | 25 using namespace irccd; |
27 | 26 |
28 TEST(TestJsSystem, home) | 27 TEST(TestJsSystem, home) |
29 { | 28 { |
30 js::Context ctx; | 29 duk::Context ctx; |
31 | 30 |
32 loadJsIrccd(ctx); | 31 loadJsIrccd(ctx); |
33 loadJsSystem(ctx); | 32 loadJsSystem(ctx); |
34 | 33 |
35 try { | 34 try { |
36 ctx.peval(js::Script{"result = Irccd.System.home();"}); | 35 duk::pevalString(ctx, "result = Irccd.System.home();"); |
37 | 36 |
38 ASSERT_EQ(sys::home(), ctx.getGlobal<std::string>("result")); | 37 ASSERT_EQ(sys::home(), duk::getGlobal<std::string>(ctx, "result")); |
39 } catch (const std::exception &ex) { | 38 } catch (const std::exception &ex) { |
40 FAIL() << ex.what(); | 39 FAIL() << ex.what(); |
41 } | 40 } |
42 } | 41 } |
43 | 42 |