2
2
// caught in other cpp files if chaiscript causes them
3
3
4
4
#include < chaiscript/utility/utility.hpp>
5
+ #include < chaiscript/dispatchkit/bootstrap_stl.hpp>
5
6
6
7
#ifdef CHAISCRIPT_MSVC
7
8
#pragma warning(push)
@@ -517,14 +518,19 @@ TEST_CASE("Utility_Test utility class wrapper")
517
518
518
519
}
519
520
521
+
520
522
enum Utility_Test_Numbers
521
523
{
522
- ONE,
524
+ ONE,
523
525
TWO,
524
526
THREE
525
527
};
526
528
527
- TEST_CASE (" Utility_Test utility class wrapper" )
529
+ void do_something_with_enum_vector (const std::vector<Utility_Test_Numbers> &)
530
+ {
531
+ }
532
+
533
+ TEST_CASE (" Utility_Test utility class wrapper for enum" )
528
534
{
529
535
530
536
chaiscript::ModulePtr m = chaiscript::ModulePtr (new chaiscript::Module ());
@@ -538,7 +544,7 @@ TEST_CASE("Utility_Test utility class wrapper")
538
544
{ { const_var (ONE), " ONE" },
539
545
{ const_var (TWO), " TWO" },
540
546
{ const_var (THREE), " THREE" }
541
-
547
+
542
548
}
543
549
);
544
550
@@ -550,6 +556,12 @@ TEST_CASE("Utility_Test utility class wrapper")
550
556
CHECK (chai.eval <Utility_Test_Numbers>(" TWO " ) == 1 );
551
557
CHECK (chai.eval <Utility_Test_Numbers>(" THREE " ) == 2 );
552
558
559
+ chai.add (chaiscript::fun (&do_something_with_enum_vector), " do_something_with_enum_vector" );
560
+ chai.add (chaiscript::vector_conversion<std::vector<Utility_Test_Numbers>>());
561
+ CHECK_NOTHROW (chai.eval (" var a = [ONE, TWO, THREE]" ));
562
+ CHECK_NOTHROW (chai.eval (" do_something_with_enum_vector([ONE])" ));
563
+ CHECK_NOTHROW (chai.eval (" [ONE]" ));
564
+
553
565
}
554
566
555
567
0 commit comments