Invalid value handling#449
Closed
vladinator1000 wants to merge 3 commits intoparcel-bundler:masterfrom
Closed
Conversation
vladinator1000
commented
Mar 22, 2023
| } | ||
| "#; | ||
|
|
||
| let parsed = StyleSheet::parse(input, ParserOptions::default()).unwrap_err(); |
Author
There was a problem hiding this comment.
This test currently fails, because the parsing result is Ok when it should be an error.
---- value_missing_closing_brace stdout ----
thread 'value_missing_closing_brace' panicked at 'called `Result::unwrap_err()` on an `Ok` value: StyleSheet { rules: CssRuleList([Style(StyleRule { selectors: SelectorList([Selector(.corrupt, specificity = 0x400)]), vendor_prefix: (empty), declarations: DeclarationBlock { important_declarations: [], declarations: [Unparsed(UnparsedProperty { property_id: Color, value: TokenList([Function(Function { name: Ident("hsla"), arguments: TokenList([Token(Number { has_sign: false, value: 120.0, int_value: Some(120) }), Token(Comma), Token(Percentage { has_sign: false, unit_value: 0.6232, int_value: None }), Token(Semicolon), Token(WhiteSpace(" ")), Token(CloseCurlyBracket)]) })]) })] }, rules: CssRuleList([]), loc: Location { source_index: 0, line: 1, column: 5 } })]), sources: [""], source_map_urls: [None], options: ParserOptions { filename: "", nesting: false, custom_media: false, css_modules: None, source_index: 0, error_recovery: false, warnings: None } }', tests/test_invalid_input.rs:15:67
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We should handle errors when parsing a value with a missing closing brace:
Related issue: #427
This aims to replicate this browser behavior
