Merge pull request #1351 from mdarse/facets-strict-match-context-regression

Fix strict facets regressions and add tests
This commit is contained in:
Benoît Burnichon
2015-04-16 09:39:26 +02:00
2 changed files with 10 additions and 1 deletions

View File

@@ -226,7 +226,7 @@ class QueryVisitor implements Visit
continue; continue;
} }
if ($node instanceof AST\Context) { if ($node instanceof AST\Context) {
if ($root instanceof ContextAbleInterface) { if ($root instanceof AST\ContextAbleInterface) {
$root = $root->withContext($node); $root = $root->withContext($node);
} else { } else {
throw new \Exception('Unexpected context after non-contextualizable node'); throw new \Exception('Unexpected context after non-contextualizable node');

View File

@@ -9,6 +9,15 @@ foo bar (baz qux)|<text:"foo bar" context:"baz qux">
[foo (bar)]|<term:"foo" context:"bar"> [foo (bar)]|<term:"foo" context:"bar">
[foo bar (baz qux)]|<term:"foo bar" context:"baz qux"> [foo bar (baz qux)]|<term:"foo bar" context:"baz qux">
# Raw string
r"foo"|<raw:"foo">
r"foo bar"|<raw:"foo bar">
r"\"foo\""|<raw:""foo"">
r"\o/"|<raw:"\o/">
r"\\o/"|<raw:"\o/">
r"foo \n bar"|<raw:"foo \n bar">
r"foo\\nbar"|<raw:"foo\nbar">
# Parenthesis grouping # Parenthesis grouping
(foo)|<text:"foo"> (foo)|<text:"foo">
(foo bar)|<text:"foo bar"> (foo bar)|<text:"foo bar">
Can't render this file because it contains an unexpected character in line 1 and column 11.