Skip to content

Commit

Permalink
feat: Allow nested empty rules in CST snapshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Nov 20, 2023
1 parent 6db11ac commit 0fe06db
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Errors: []
Tree:
- TupleExpression (Rule): # 0..3 "( )"
- OpenParen (Token): "(" # 0..1
- TupleValuesList (Rule): [] # 1..1
- TupleValuesList (Rule): # 1..1
- TupleValue (Rule): [] # 1..1
- CloseParen (Token): ")" # 2..3
1 change: 1 addition & 0 deletions crates/solidity/testing/utils/src/cst_snapshots/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ fn write_node<W: Write>(

let (node_value, node_comment) = if node.range.is_empty() {
let preview = match node.kind {
TestNodeKind::Rule(_) if !node.children.is_empty() => "",
TestNodeKind::Rule(_) => " []",
TestNodeKind::Token(_) | TestNodeKind::Trivia(_) => " \"\"",
};
Expand Down

0 comments on commit 0fe06db

Please sign in to comment.