Skip to content

Commit 2ad55d3

Browse files
committed
simplify some tests
1 parent f158f6e commit 2ad55d3

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

nix-script-directives/src/expr.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl FromStr for Expr {
8888
}
8989
}
9090

91-
/// Unwrap parentheses.
91+
/// Unwrap parentheses when converting from a [`SyntaxNode`].
9292
impl From<SyntaxNode> for Expr {
9393
fn from(outer: SyntaxNode) -> Expr {
9494
if outer.kind() == SyntaxKind::NODE_PAREN {
@@ -141,23 +141,17 @@ mod tests {
141141

142142
#[test]
143143
fn unwraps_root() {
144-
assert_eq!(SyntaxKind::NODE_IDENT, Expr::from_str("a").unwrap().kind())
144+
assert!(Expr::from_str("a").unwrap().is_leaf())
145145
}
146146

147147
#[test]
148148
fn unwraps_parens() {
149-
assert_eq!(
150-
SyntaxKind::NODE_IDENT,
151-
Expr::from_str("(a)").unwrap().kind()
152-
)
149+
assert!(Expr::from_str("(a)").unwrap().is_leaf())
153150
}
154151

155152
#[test]
156153
fn unwraps_all_parens() {
157-
assert_eq!(
158-
SyntaxKind::NODE_IDENT,
159-
Expr::from_str("((a))").unwrap().kind()
160-
)
154+
assert!(Expr::from_str("((a))").unwrap().is_leaf())
161155
}
162156
}
163157

0 commit comments

Comments
 (0)