Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update recursion ui error #27

Merged
merged 1 commit into from
Jun 23, 2024

Conversation

manunio
Copy link
Contributor

@manunio manunio commented Jun 23, 2024

I think previous input for filter-recursion ui test was not right as it was not triggering error for recursion itself, for example:

fn fuzzed_filter_recursion() {
    const TEMPLATE: &str = include_str!("../tests/filter-recursion.txt");
    if let Err(e) = Ast::from_str(TEMPLATE, None, &Syntax::default()) {
        panic!("{e}");
    }
}
---- tests::fuzzed_filter_recursion stdout ----
thread 'tests::fuzzed_filter_recursion' panicked at rinja_parser/src/tests.rs:1121:9:
failed to parse template source at row 1, column 255 near:
"|A|AA|A|A|A|A|AA|A|A|A|A|AA|A|A|A|A|AA|A"...

I think previous input for filter-recursion ui test was not right as it
was not triggering error for recursion itself, for example:

```rust
fn fuzzed_filter_recursion() {
    const TEMPLATE: &str = include_str!("../tests/filter-recursion.txt");
    if let Err(e) = Ast::from_str(TEMPLATE, None, &Syntax::default()) {
        panic!("{e}");
    }
}
```

```sh
---- tests::fuzzed_filter_recursion stdout ----
thread 'tests::fuzzed_filter_recursion' panicked at rinja_parser/src/tests.rs:1121:9:
failed to parse template source at row 1, column 255 near:
"|A|AA|A|A|A|A|AA|A|A|A|A|AA|A|A|A|A|AA|A"...
```
error: unclosed expression, missing "}}"
failed to parse template source at row 1, column 0 near:
"{{ s|a|a|a|a|a|a|a|A|a|a|a|a|a|a|a|a|a|a"...
error: failed to parse template source
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking out loud but the error is not great. It should indicate that it hits the recursion limit. Gonna open an issue for that.

@GuillaumeGomez
Copy link
Contributor

Thanks!

@GuillaumeGomez GuillaumeGomez merged commit 704c506 into rinja-rs:master Jun 23, 2024
17 checks passed
@manunio manunio deleted the fix-filter-recursion-error branch June 23, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants