Skip to content

Commit ac78896

Browse files
committed
test(python): an escaped string in __all__ is no effect
WHY: the multiple-bindings test pinned an UNKNOWN EFFECT fact for `__all__ = ['escaped\n']`, which only existed because the namespace facts proved plain one-line strings harmless and nothing else. A string literal, escapes included, evaluates nothing, which is this branch's rule, so the fact is gone. ALL_UNKNOWN stays: an escaped name is no literal export name. The assertion still pins the exact stream (13 facts, verified against an index of the same source with the base and this branch). Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent bf56fcf commit ac78896

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎tests/test_extraction.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12755,7 +12755,7 @@ TEST(python_namespace_facts_multiple_bindings_and_unsupported_effects) {
1275512755
"__all__ = ['escaped\\n']\n";
1275612756
CBMFileResult *r = extract(source, CBM_LANG_PYTHON, "t", "main.py");
1275712757
bool ok = r && !r->has_error && !r->parse_incomplete &&
12758-
r->py_namespace.status == CBM_PY_NS_COMPLETE && r->py_namespace.count == 14 &&
12758+
r->py_namespace.status == CBM_PY_NS_COMPLETE && r->py_namespace.count == 13 &&
1275912759
cbm_py_namespace_facts_valid(&r->py_namespace) && has_def(r, "Function", "later") &&
1276012760
has_def(r, "Class", "HasDescriptor");
1276112761
if (ok) {
@@ -12771,8 +12771,10 @@ TEST(python_namespace_facts_multiple_bindings_and_unsupported_effects) {
1277112771
strcmp(f[7].local_name, "__all__") == 0 && f[8].kind == CBM_PY_NS_UNKNOWN &&
1277212772
f[9].kind == CBM_PY_NS_SHADOW && strcmp(f[9].local_name, "values") == 0 &&
1277312773
f[10].kind == CBM_PY_NS_UNKNOWN && f[11].kind == CBM_PY_NS_SHADOW &&
12774-
f[11].reason == CBM_PY_NS_REASON_UNPROVEN_CLASS && f[12].kind == CBM_PY_NS_UNKNOWN &&
12775-
f[13].kind == CBM_PY_NS_ALL_UNKNOWN;
12774+
f[11].reason == CBM_PY_NS_REASON_UNPROVEN_CLASS &&
12775+
/* a string with an escape evaluates nothing: no effect, but no
12776+
* literal export name either */
12777+
f[12].kind == CBM_PY_NS_ALL_UNKNOWN;
1277612778
}
1277712779
if (r)
1277812780
cbm_free_result(r);

0 commit comments

Comments
 (0)