Skip to content

Commit

Permalink
Added comments to sample tests (#2100)
Browse files Browse the repository at this point in the history
1. Added clarification comment why we need two expected strings in
sample testing.
2. Made general comment a normal comment rather than doc comment -
otherwise it was bound to the first constant in the file.

---------

Co-authored-by: Dmitry Vasilevsky <[email protected]>
Co-authored-by: orpuente-MS <[email protected]>
  • Loading branch information
3 people authored Jan 10, 2025
1 parent 740c492 commit 3e83ec3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions samples_test/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ use qsc::{
};
use qsc_project::{FileSystem, StdFs};

// Two tests are needed to check interpreter working in debug and non-debug mode.
// This results in two expected strings defined. Although two strings are typically the same,
// there may be a difference. Also, having two separate strings helps with
// automatic updates of expected value by Rust analyzer.
fn compile_and_run(sources: SourceMap) -> String {
compile_and_run_internal(sources, false)
}
Expand Down
6 changes: 3 additions & 3 deletions samples_test/src/tests/algorithms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

use expect_test::{expect, Expect};

/// Each file in the samples/algorithms folder is compiled and run as two tests and should
/// have matching expect strings in this file. If new samples are added, this file will
/// fail to compile until the new expect strings are added.
// Each file in the samples/algorithms folder is compiled and run as two tests and should
// have matching expect strings in this file. If new samples are added, this file will
// fail to compile until the new expect strings are added.
pub const BELLSTATE_EXPECT: Expect = expect![[r#"
Bell state |Φ+〉:
STATE:
Expand Down
6 changes: 3 additions & 3 deletions samples_test/src/tests/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

use expect_test::{expect, Expect};

/// Each file in the samples/language folder is compiled and run as two tests and should
/// have matching expect strings in this file. If new samples are added, this file will
/// fail to compile until the new expect strings are added.
// Each file in the samples/language folder is compiled and run as two tests and should
// have matching expect strings in this file. If new samples are added, this file will
// fail to compile until the new expect strings are added.
pub const ARITHMETICOPERATORS_EXPECT: Expect = expect!["()"];
pub const ARITHMETICOPERATORS_EXPECT_DEBUG: Expect = expect!["()"];
pub const ARRAY_EXPECT: Expect = expect![[r#"
Expand Down

0 comments on commit 3e83ec3

Please sign in to comment.