Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nbacquey committed Dec 17, 2024
1 parent 7064b86 commit 765dda7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions topiary-core/tests/comment_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use topiary_core::{
Commented::{CommentedAfter, CommentedBefore},
SeparatedInput,
},
tree_sitter::parse,
types::InputSection,
common::{parse, InputSection},
Position,
};

Expand Down Expand Up @@ -48,34 +47,39 @@ fn test_extract_comments() {
let input = OCAML_WITH_COMMENTS;
let ocaml = tree_sitter_ocaml::LANGUAGE_OCAML;

let (tree, _grammar) = parse(input, &ocaml.into(), false).unwrap();
let tree = parse(input, &ocaml.into(), false, None).unwrap();

let SeparatedInput {
input_tree: _,
input_string: new_input_string,
mut comments,
} = extract_comments(&tree, input, &ocaml.into()).unwrap();
} = extract_comments(&tree, input, &ocaml.into(), false).unwrap();

let mut expected_comments: Vec<AnchoredComment> = vec![
AnchoredComment {
comment_text: "(* starting comment *)".into(),
commented: CommentedAfter(FUN_SECTION),
original_column: 1,
},
AnchoredComment {
comment_text: "(* fun comment *)".into(),
commented: CommentedBefore(FUN_SECTION),
original_column: 5,
},
AnchoredComment {
comment_text: "(* var comment *)".into(),
commented: CommentedBefore(VAR_SECTION),
original_column: 25,
},
AnchoredComment {
comment_text: "(** multi-lined\n * body comment\n *)".into(),
commented: CommentedAfter(BODY_SECTION),
original_column: 3,
},
AnchoredComment {
comment_text: "(* final comment *)".into(),
commented: CommentedBefore(BODY_SECTION),
original_column: 1,
},
];

Expand Down

0 comments on commit 765dda7

Please sign in to comment.