diff --git a/src/syntax_tree/mod.rs b/src/syntax_tree/mod.rs index 5df3ba1..e0e100c 100644 --- a/src/syntax_tree/mod.rs +++ b/src/syntax_tree/mod.rs @@ -9,3 +9,4 @@ pub use printer::print_tree; pub use traverser::traverse_tree; pub use alias::find_aliases; +pub use nushell::validate_nu_tree_sitter_code; diff --git a/src/syntax_tree/nushell.rs b/src/syntax_tree/nushell.rs index 7905758..abcfe9b 100644 --- a/src/syntax_tree/nushell.rs +++ b/src/syntax_tree/nushell.rs @@ -11,3 +11,22 @@ pub fn validate_nu_tree_sitter_code(content: &String) -> bool { parser.parse(content, None).is_some() } + +// pub fn validate_nu_parsing(content: &String) -> bool { +// // TODO: +// } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_validate_nu_tree_sitter_code_valid_input() { + let valid_nu_code = "alias ll = ls -alF".to_string(); + let result = validate_nu_tree_sitter_code(&valid_nu_code); + assert!( + result, + "Expected valid Nu code to return true, but got false" + ); + } +}