Fix issues with trim() and with unit tests relying on certain line endings.

This commit is contained in:
Jason Turner
2011-05-20 16:01:50 -06:00
parent 2786156086
commit 319f9e4de9
3 changed files with 6 additions and 6 deletions

View File

@@ -807,8 +807,8 @@ namespace chaiscript
const std::vector<Type_Info> lhsparamtypes = lhs->get_param_types();
const std::vector<Type_Info> rhsparamtypes = rhs->get_param_types();
const int lhssize = lhsparamtypes.size();
const int rhssize = rhsparamtypes.size();
const size_t lhssize = lhsparamtypes.size();
const size_t rhssize = rhsparamtypes.size();
const Type_Info boxed_type = user_type<Boxed_Value>();
const Type_Info boxed_pod_type = user_type<Boxed_POD_Value>();
@@ -843,7 +843,7 @@ namespace chaiscript
for (int i = 1; i < lhssize && i < rhssize; ++i)
for (size_t i = 1; i < lhssize && i < rhssize; ++i)
{
const Type_Info lt = lhsparamtypes[i];
const Type_Info rt = rhsparamtypes[i];

View File

@@ -305,10 +305,10 @@ def string::find_last_not_of(list) : is_type(list, "string") { \n\
int(find_last_not_of(this, list, -1)); \n\
} \n\
def string::ltrim() { \n\
drop_while(this, fun(x) { x == ' ' || x == '\t' }); \n\
drop_while(this, fun(x) { x == ' ' || x == '\t' || x == '\r' || x == '\n'}); \n\
} \n\
def string::rtrim() { \n\
reverse(drop_while(reverse(this), fun(x) { x == ' ' || x == '\t' })); \n\
reverse(drop_while(reverse(this), fun(x) { x == ' ' || x == '\t' || x == '\r' || x == '\n'})); \n\
} \n\
def string::trim() { \n\
ltrim(rtrim(this)); \n\

View File

@@ -10,7 +10,7 @@ def test_function(a)
// test_function tests
assert_equal(test_function.get_arity(), 1);
assert_equal(test_function.get_annotation(), "#Test Function Description\n");
assert_equal(trim(test_function.get_annotation()), "#Test Function Description");
assert_equal(test_function.get_contained_functions().size(), 0);
assert_equal(test_function.get_param_types().size(), 2);