fixed string interpolation during comparison (as pointed out by @Lucki, thanks)
This commit is contained in:
parent
b0ae8def1b
commit
e3388d5fc7
|
@ -2990,8 +2990,18 @@ ValueObject *interpretEqualityOpExprNode(OpExprNode *expr,
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
/* If comparing strings, interpolate them first */
|
||||
ValueObject *old1 = val1;
|
||||
ValueObject *old2 = val2;
|
||||
if (val1->type == VT_STRING) {
|
||||
val1 = castStringExplicit(val1, scope);
|
||||
val2 = castStringExplicit(val2, scope);
|
||||
deleteValueObject(old1);
|
||||
deleteValueObject(old2);
|
||||
}
|
||||
ret = BoolOpJumpTable[expr->type - OP_EQ][val1->type][val2->type](val1, val2);
|
||||
}
|
||||
deleteValueObject(val1);
|
||||
deleteValueObject(val2);
|
||||
return ret;
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
INCLUDE(AddLolTest)
|
||||
ADD_LOL_TEST(3-Comparison OUTPUT test.out)
|
|
@ -0,0 +1,41 @@
|
|||
HAI 1.3
|
||||
CAN HAS STRING?
|
||||
|
||||
I HAS A string ITZ "::hello"
|
||||
|
||||
I HAS A char ITZ I IZ STRING'Z AT YR string AN YR 0 MKAY
|
||||
VISIBLE char AN " - " AN "::"
|
||||
|
||||
BOTH SAEM char AN "::", O RLY?
|
||||
YA RLY
|
||||
VISIBLE "success"
|
||||
NO WAI
|
||||
VISIBLE "fail"
|
||||
OIC
|
||||
|
||||
VISIBLE char AN " - " AN ":(3A)"
|
||||
BOTH SAEM char AN ":(3A)", O RLY?
|
||||
YA RLY
|
||||
VISIBLE "success"
|
||||
NO WAI
|
||||
VISIBLE "fail"
|
||||
OIC
|
||||
|
||||
I HAS A char2 ITZ I IZ STRING'Z AT YR string AN YR 1 MKAY
|
||||
VISIBLE char2 AN " - " AN "h"
|
||||
BOTH SAEM char2 AN "h", O RLY?
|
||||
YA RLY
|
||||
VISIBLE "success"
|
||||
NO WAI
|
||||
VISIBLE "fail"
|
||||
OIC
|
||||
|
||||
I HAS A char3 ITZ "::"
|
||||
VISIBLE char3 AN " - " AN "::"
|
||||
BOTH SAEM char3 AN "::", O RLY?
|
||||
YA RLY
|
||||
VISIBLE "success"
|
||||
NO WAI
|
||||
VISIBLE "fail"
|
||||
OIC
|
||||
KTHXBYE
|
|
@ -0,0 +1,8 @@
|
|||
: - :
|
||||
success
|
||||
: - :
|
||||
success
|
||||
h - h
|
||||
success
|
||||
: - :
|
||||
success
|
|
@ -0,0 +1,2 @@
|
|||
This test checks that strings containing escape sequences are compared
|
||||
correctly.
|
|
@ -1,2 +1,3 @@
|
|||
add_subdirectory(1-Escapes)
|
||||
add_subdirectory(2-Syntax)
|
||||
add_subdirectory(3-Comparison)
|
||||
|
|
|
@ -43575,7 +43575,7 @@ long convertNormativeNameToCodePoint(const char *name)
|
|||
{
|
||||
int index = binarySearch(names, 0, NUM_UNICODE - 1, name);
|
||||
if (index < 0) {
|
||||
fprintf(stderr, "Invalid Unicode normative name.\n");
|
||||
fprintf(stderr, "Invalid Unicode normative name: %s.\n", name);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue