Skip to content

Commit

Permalink
chore: update spec_tests code
Browse files Browse the repository at this point in the history
This is to keep them consistent with the existing code.
  • Loading branch information
Sec-ant committed Mar 31, 2024
1 parent db8b4cf commit f22ffa7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
7 changes: 4 additions & 3 deletions crates/biome_css_analyze/tests/spec_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,13 @@ fn check_code_action(
action: &AnalyzerAction<CssLanguage>,
options: CssParserOptions,
) {
let (new_tree, Some((_, text_edit))) = action
let (new_tree, text_edit) = match action
.mutation
.clone()
.commit_with_text_range_and_edit(true)
else {
todo!();
{
(new_tree, Some((_, text_edit))) => (new_tree, text_edit),
(new_tree, None) => (new_tree, Default::default()),
};

let output = text_edit.new_string(source);
Expand Down
7 changes: 4 additions & 3 deletions crates/biome_js_analyze/tests/spec_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,13 @@ fn check_code_action(
action: &AnalyzerAction<JsLanguage>,
options: JsParserOptions,
) {
let (new_tree, Some((_, text_edit))) = action
let (new_tree, text_edit) = match action
.mutation
.clone()
.commit_with_text_range_and_edit(true)
else {
panic!("text edit doesn't exist");
{
(new_tree, Some((_, text_edit))) => (new_tree, text_edit),
(new_tree, None) => (new_tree, Default::default()),
};

let output = text_edit.new_string(source);
Expand Down
7 changes: 4 additions & 3 deletions crates/biome_js_transform/tests/spec_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,13 @@ fn check_transformation(
transformation: &AnalyzerTransformation<JsLanguage>,
options: JsParserOptions,
) {
let (new_tree, Some((_, text_edit))) = transformation
let (new_tree, text_edit) = match transformation
.mutation
.clone()
.commit_with_text_range_and_edit(true)
else {
panic!("text edit doesn't exist");
{
(new_tree, Some((_, text_edit))) => (new_tree, text_edit),
(new_tree, None) => (new_tree, Default::default()),
};

let output = text_edit.new_string(source);
Expand Down
7 changes: 4 additions & 3 deletions crates/biome_json_analyze/tests/spec_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,13 @@ pub(crate) fn analyze_and_snap(
}

fn check_code_action(path: &Path, source: &str, action: &AnalyzerAction<JsonLanguage>) {
let (new_tree, Some((_, text_edit))) = action
let (new_tree, text_edit) = match action
.mutation
.clone()
.commit_with_text_range_and_edit(true)
else {
panic!("text edit doesn't exist");
{
(new_tree, Some((_, text_edit))) => (new_tree, text_edit),
(new_tree, None) => (new_tree, Default::default()),
};

let output = text_edit.new_string(source);
Expand Down
7 changes: 4 additions & 3 deletions crates/biome_migrate/tests/spec_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,13 @@ pub(crate) fn analyze_and_snap(
}

fn check_code_action(path: &Path, source: &str, action: &AnalyzerAction<JsonLanguage>) {
let (new_tree, Some((_, text_edit))) = action
let (new_tree, text_edit) = match action
.mutation
.clone()
.commit_with_text_range_and_edit(true)
else {
panic!("text edit doesn't exist");
{
(new_tree, Some((_, text_edit))) => (new_tree, text_edit),
(new_tree, None) => (new_tree, Default::default()),
};

let output = text_edit.new_string(source);
Expand Down

0 comments on commit f22ffa7

Please sign in to comment.