Menu

[r2392]: / framework / trunk / tests / plugin_test.cpp  Maximize  Restore  History

Download this file

38 lines (35 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <cppcms/plugin.h>
#include <booster/shared_object.h>
#include <iostream>
#include "test.h"
int main()
{
try {
booster::shared_object obj(booster::shared_object::name("plugin"));
{
booster::callback<std::string(std::string const &)> cb;
cb = cppcms::plugin::manager::entry<std::string(std::string const &)>("foo::lower");
TEST(cb("Hello World")=="hello world");
try {
cppcms::plugin::manager::entry<std::string(std::string &)>("foo::lower");
TEST(!"Never Get There");
}
catch(booster::bad_cast const &) {}
catch(...) { throw std::runtime_error("Something else thrown"); }
}
obj.close();
try {
cppcms::plugin::manager::entry<std::string(std::string const &)>("foo::lower");
std::cerr << "Must Not get there!" <<std::endl;
return 1;
}
catch(cppcms::cppcms_error const &) {}
catch(...) { throw std::runtime_error("Something else thrown"); }
}
catch(std::exception const &e) {
std::cerr << "Error:" << e.what() << std::endl;
return 1;
}
std::cout << "Ok" << std::endl;
return 0;
}
MongoDB Logo MongoDB