comparison tests/src/libirccd-js/js-api-system/main.cpp @ 773:8c44bbcbbab9

Misc: style, cleanup and update
author David Demelier <markand@malikania.fr>
date Fri, 26 Oct 2018 13:01:00 +0200
parents 28f493661157
children 06cc2f95f479
comparison
equal deleted inserted replaced
772:f5ccf65ae929 773:8c44bbcbbab9
32 32
33 BOOST_FIXTURE_TEST_SUITE(system_js_api_suite, js_fixture) 33 BOOST_FIXTURE_TEST_SUITE(system_js_api_suite, js_fixture)
34 34
35 BOOST_AUTO_TEST_CASE(home) 35 BOOST_AUTO_TEST_CASE(home)
36 { 36 {
37 duk_peval_string_noresult(plugin_->get_context(), "result = Irccd.System.home();"); 37 duk_peval_string_noresult(plugin_->get_context(), "result = Irccd.System.home();");
38 38
39 BOOST_TEST(duk_get_global_string(plugin_->get_context(),"result")); 39 BOOST_TEST(duk_get_global_string(plugin_->get_context(),"result"));
40 BOOST_TEST(duk_get_string(plugin_->get_context(), -1) == sys::home()); 40 BOOST_TEST(duk_get_string(plugin_->get_context(), -1) == sys::home());
41 } 41 }
42 42
43 #if defined(IRCCD_HAVE_POPEN) 43 #if defined(IRCCD_HAVE_POPEN)
44 44
45 BOOST_AUTO_TEST_CASE(popen) 45 BOOST_AUTO_TEST_CASE(popen)
46 { 46 {
47 auto ret = duk_peval_string(plugin_->get_context(), 47 auto ret = duk_peval_string(plugin_->get_context(),
48 "f = Irccd.System.popen(\"" IRCCD_EXECUTABLE " --version\", \"r\");" 48 "f = Irccd.System.popen(\"" IRCCD_EXECUTABLE " --version\", \"r\");"
49 "r = f.readline();" 49 "r = f.readline();"
50 ); 50 );
51 51
52 if (ret != 0) 52 if (ret != 0)
53 throw duk::get_stack(plugin_->get_context(), -1); 53 throw duk::get_stack(plugin_->get_context(), -1);
54 54
55 BOOST_TEST(duk_get_global_string(plugin_->get_context(), "r")); 55 BOOST_TEST(duk_get_global_string(plugin_->get_context(), "r"));
56 BOOST_TEST(duk_get_string(plugin_->get_context(), -1) == IRCCD_VERSION); 56 BOOST_TEST(duk_get_string(plugin_->get_context(), -1) == IRCCD_VERSION);
57 } 57 }
58 58
59 #endif 59 #endif
60 60
61 BOOST_AUTO_TEST_SUITE_END() 61 BOOST_AUTO_TEST_SUITE_END()