Mercurial > irccd
comparison tests/js-directory/main.cpp @ 514:16b9ebfd3f08
Irccd: get rid of fs.hpp, closes #594
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 24 Oct 2017 12:52:20 +0200 |
parents | |
children | b557017ad3f0 |
comparison
equal
deleted
inserted
replaced
513:928a40398dec | 514:16b9ebfd3f08 |
---|---|
1 /* | |
2 * main.cpp -- test Irccd.Directory API | |
3 * | |
4 * Copyright (c) 2013-2017 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 #define BOOST_TEST_MODULE "Directory Javascript API" | |
20 #include <boost/test/unit_test.hpp> | |
21 | |
22 #include <irccd/js_directory_module.hpp> | |
23 | |
24 #include <js_test.hpp> | |
25 | |
26 namespace irccd { | |
27 | |
28 class directory_test : public js_test<js_directory_module> { | |
29 public: | |
30 }; | |
31 | |
32 BOOST_FIXTURE_TEST_SUITE(js_directory_suite, directory_test) | |
33 | |
34 BOOST_AUTO_TEST_CASE(constructor) | |
35 { | |
36 const std::string script( | |
37 "d = new Irccd.Directory(TESTS_BINARY_DIR + \"/level-1\");" | |
38 "p = d.path;" | |
39 "e = d.entries;" | |
40 ); | |
41 | |
42 if (duk_peval_string(plugin_->context(), script.c_str()) != 0) | |
43 throw dukx_exception(plugin_->context(), -1); | |
44 | |
45 duk_get_global_string(plugin_->context(), "l"); | |
46 BOOST_TEST(duk_get_int(plugin_->context(), -1) == 2); | |
47 } | |
48 | |
49 BOOST_AUTO_TEST_SUITE_END() | |
50 | |
51 } // !irccd |