forked from lix-project/lix
* String equality tests should take the context into account. All the
evaluation test cases now succeed.
This commit is contained in:
parent
6bbfe95e30
commit
2d7636529f
|
@ -1019,9 +1019,17 @@ bool EvalState::eqValues(Value & v1, Value & v2)
|
||||||
case tBool:
|
case tBool:
|
||||||
return v1.boolean == v2.boolean;
|
return v1.boolean == v2.boolean;
|
||||||
|
|
||||||
case tString:
|
case tString: {
|
||||||
/* !!! contexts */
|
/* Compare both the string and its context. */
|
||||||
return strcmp(v1.string.s, v2.string.s) == 0;
|
if (strcmp(v1.string.s, v2.string.s) != 0) return false;
|
||||||
|
const char * * p = v1.string.context, * * q = v2.string.context;
|
||||||
|
if (!p && !q) return true;
|
||||||
|
if (!p || !q) return false;
|
||||||
|
for ( ; *p && *q; ++p, ++q)
|
||||||
|
if (strcmp(*p, *q) != 0) return false;
|
||||||
|
if (*p || *q) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
case tPath:
|
case tPath:
|
||||||
return strcmp(v1.path, v2.path) == 0;
|
return strcmp(v1.path, v2.path) == 0;
|
||||||
|
|
|
@ -69,7 +69,7 @@ struct Value
|
||||||
For canonicity, the store paths should be in sorted order. */
|
For canonicity, the store paths should be in sorted order. */
|
||||||
struct {
|
struct {
|
||||||
const char * s;
|
const char * s;
|
||||||
const char * * context;
|
const char * * context; // must be in sorted order
|
||||||
} string;
|
} string;
|
||||||
|
|
||||||
const char * path;
|
const char * path;
|
||||||
|
|
Loading…
Reference in a new issue