mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-27 06:27:43 +00:00
revset: allow empty string literal ""
This commit is contained in:
parent
57ff990fe8
commit
84efed420f
3 changed files with 13 additions and 1 deletions
|
@ -21,7 +21,7 @@ symbol = {
|
|||
identifier
|
||||
| literal_string
|
||||
}
|
||||
literal_string = { "\"" ~ (!"\"" ~ ANY)+ ~ "\"" }
|
||||
literal_string = { "\"" ~ (!"\"" ~ ANY)* ~ "\"" }
|
||||
whitespace = _{ " " }
|
||||
|
||||
parents_op = { "-" }
|
||||
|
|
|
@ -1890,6 +1890,12 @@ mod tests {
|
|||
message: "Expected 1 argument".to_string()
|
||||
})
|
||||
);
|
||||
assert_eq!(
|
||||
parse(r#"description("")"#),
|
||||
Ok(RevsetExpression::filter(
|
||||
RevsetFilterPredicate::Description("".to_string())
|
||||
))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("description(foo)"),
|
||||
Ok(RevsetExpression::filter(
|
||||
|
|
|
@ -102,6 +102,12 @@ fn test_resolve_symbol_commit_id() {
|
|||
Ok(vec![commits[2].id().clone()])
|
||||
);
|
||||
|
||||
// Test empty commit id
|
||||
assert_eq!(
|
||||
resolve_symbol(repo_ref, "", None),
|
||||
Err(RevsetError::AmbiguousCommitIdPrefix("".to_string()))
|
||||
);
|
||||
|
||||
// Test commit id prefix
|
||||
assert_eq!(
|
||||
resolve_symbol(repo_ref, "046", None),
|
||||
|
|
Loading…
Reference in a new issue