Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sezna committed Dec 23, 2024
1 parent eea9581 commit 540de0b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 33 deletions.
10 changes: 2 additions & 8 deletions compiler/qsc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ pub mod test_callables {
pub location: Location,
}

pub fn get_test_callables(
unit: &CompileUnit
) -> impl Iterator<Item = TestDescriptor> + '_ {
pub fn get_test_callables(unit: &CompileUnit) -> impl Iterator<Item = TestDescriptor> + '_ {
let test_callables = unit.package.get_test_callables();

test_callables.into_iter().map(|(name, span)| {
Expand All @@ -33,11 +31,7 @@ pub mod test_callables {

let location = Location {
source: source.name.clone(),
range: Range::from_span(
Encoding::Utf8,
&source.contents,
&(span - source.offset),
),
range: Range::from_span(Encoding::Utf8, &source.contents, &(span - source.offset)),
};
TestDescriptor {
callable_name: name,
Expand Down
2 changes: 1 addition & 1 deletion compiler/qsc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ impl Package {

let span = item.span;

Some((name,span))
Some((name, span))
} else {
None
}
Expand Down
2 changes: 1 addition & 1 deletion vscode/src/debugger/output.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { log, QscEventTarget } from "qsharp-lang";
import { QscEventTarget } from "qsharp-lang";

function formatComplex(real: number, imag: number) {
// Format -0 as 0
Expand Down
10 changes: 3 additions & 7 deletions vscode/src/testExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
// This file uses the VS Code Test Explorer API (https://code.visualstudio.com/docs/editor/testing)

import * as vscode from "vscode";
import {
ICompilerWorker,
log,
ProgramConfig,
} from "qsharp-lang";
import { ICompilerWorker, log, ProgramConfig } from "qsharp-lang";
import { getActiveProgram } from "./programConfig";
import {
getCommonCompilerWorker,
Expand Down Expand Up @@ -69,7 +65,7 @@ function mkRefreshHandler(
const part = parts[i];
const id = i === parts.length - 1 ? callableName : part;
if (!rover.get(part)) {
let testItem = ctrl.createTestItem(id, part, vscLocation.uri);
const testItem = ctrl.createTestItem(id, part, vscLocation.uri);
testItem.range = vscLocation.range;
rover.add(testItem);
}
Expand Down Expand Up @@ -178,7 +174,7 @@ async function runTestCase(
}
const run = ctrl.createTestRun(request);
const evtTarget = createDebugConsoleEventTarget((msg) => {
run.appendOutput(msg);
run.appendOutput(`${msg}\n`);
});
evtTarget.addEventListener("Result", (msg) => {
if (msg.detail.success) {
Expand Down
36 changes: 20 additions & 16 deletions wasm/src/test_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Licensed under the MIT License.

use qsc::{compile, PackageType};
use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::wasm_bindgen;
use serde::{Serialize, Deserialize};


use crate::{
project_system::{into_qsc_args, ProgramConfig}, serializable_type, STORE_CORE_STD
project_system::{into_qsc_args, ProgramConfig},
serializable_type, STORE_CORE_STD,
};

serializable_type! {
Expand Down Expand Up @@ -37,20 +37,24 @@ pub fn get_test_callables(config: ProgramConfig) -> Result<Vec<ITestDescriptor>,
PackageType::Lib,
capabilities,
language_features,
);
);
unit
});


let test_descriptors = qsc::test_callables::get_test_callables(
&compile_unit
);

Ok(test_descriptors.map(|qsc::test_callables::TestDescriptor { callable_name, location }| {
TestDescriptor {
callable_name,
location: location.into(),
}.into()
}).collect())

let test_descriptors = qsc::test_callables::get_test_callables(&compile_unit);

Ok(test_descriptors
.map(
|qsc::test_callables::TestDescriptor {
callable_name,
location,
}| {
TestDescriptor {
callable_name,
location: location.into(),
}
.into()
},
)
.collect())
}

0 comments on commit 540de0b

Please sign in to comment.