Skip to content

Commit be122df

Browse files
Add CLI flag parsing tests and complete implementation
Co-authored-by: felix-andreas-copilot <[email protected]>
1 parent d9c2cc6 commit be122df

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

crates/roughly/src/cli.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,3 +499,44 @@ pub fn parse_experimental_flags(flags: &[impl AsRef<str>]) -> ExperimentalFeatur
499499

500500
features
501501
}
502+
503+
#[cfg(test)]
504+
mod tests {
505+
use super::*;
506+
507+
#[test]
508+
fn test_parse_experimental_flags() {
509+
let flags = vec!["goto_references"];
510+
let features = parse_experimental_flags(&flags);
511+
512+
assert!(features.goto_references);
513+
assert!(!features.goto_definition);
514+
assert!(!features.rename);
515+
assert!(!features.range_formatting);
516+
assert!(!features.unused);
517+
}
518+
519+
#[test]
520+
fn test_parse_experimental_flags_all() {
521+
let flags = vec!["all"];
522+
let features = parse_experimental_flags(&flags);
523+
524+
assert!(features.goto_references);
525+
assert!(features.goto_definition);
526+
assert!(features.rename);
527+
assert!(features.range_formatting);
528+
assert!(features.unused);
529+
}
530+
531+
#[test]
532+
fn test_parse_experimental_flags_multiple() {
533+
let flags = vec!["goto_references", "goto_definition"];
534+
let features = parse_experimental_flags(&flags);
535+
536+
assert!(features.goto_references);
537+
assert!(features.goto_definition);
538+
assert!(!features.rename);
539+
assert!(!features.range_formatting);
540+
assert!(!features.unused);
541+
}
542+
}

0 commit comments

Comments
 (0)