Skip to content

Commit 7e58ea8

Browse files
committed
ui tests: Make pretty-llbc the default behavior
1 parent 40fd5df commit 7e58ea8

8 files changed

Lines changed: 3 additions & 15 deletions

charon/tests/ui.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ enum TestKind {
2525
KnownFailure,
2626
KnownPanic,
2727
Skip,
28-
Unspecified,
2928
}
3029

3130
struct MagicComments {
@@ -40,7 +39,7 @@ struct MagicComments {
4039

4140
static HELP_STRING: &str = unindent!(
4241
"Options are:
43-
- `//@ output=pretty-llbc`: record the pretty-printed llbc;
42+
- `//@ output=pretty-llbc`: record the pretty-printed llbc (default);
4443
- `//@ known-failure`: a test that is expected to fail.
4544
- `//@ known-panic`: a test that is expected to panic.
4645
- `//@ skip`: skip the test.
@@ -56,7 +55,7 @@ static HELP_STRING: &str = unindent!(
5655
fn parse_magic_comments(input_path: &std::path::Path) -> anyhow::Result<MagicComments> {
5756
// Parse the magic comments.
5857
let mut comments = MagicComments {
59-
test_kind: TestKind::Unspecified,
58+
test_kind: TestKind::PrettyLlbc,
6059
cli_opts: CliOpts::default(),
6160
check_output: true,
6261
auxiliary_crates: Vec::new(),
@@ -141,10 +140,6 @@ fn path_to_crate_name(path: &Path) -> Option<String> {
141140
}
142141

143142
fn perform_test(test_case: &Case, action: Action) -> anyhow::Result<()> {
144-
if matches!(test_case.magic_comments.test_kind, TestKind::Unspecified) {
145-
bail!("Test must start with a magic comment that determines its kind. {HELP_STRING}");
146-
}
147-
148143
// Dependencies
149144
// Vec of (crate name, path to crate.rs, path to libcrate.rlib).
150145
let deps: Vec<(String, PathBuf, String)> = test_case
@@ -216,7 +211,7 @@ fn perform_test(test_case: &Case, action: Action) -> anyhow::Result<()> {
216211
bail!("Compilation failed: {stderr}")
217212
}
218213
}
219-
TestKind::Skip | TestKind::Unspecified => unreachable!(),
214+
TestKind::Skip => unreachable!(),
220215
}
221216
if test_case.magic_comments.check_output {
222217
let actual = snapbox::Data::text(stderr).map_text(snapbox::utils::normalize_lines);

charon/tests/ui/issue-118-generic-copy.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ output=pretty-llbc
21
#![allow(unused)]
32

43
#[derive(Clone, Copy)]

charon/tests/ui/issue-4-traits.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ output=pretty-llbc
21
use std::convert::TryInto;
32
fn trait_error(s: &[u8]) {
43
let _array: [u8; 4] = s.try_into().unwrap();

charon/tests/ui/issue-45-misc.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ output=pretty-llbc
21
pub fn map(x: [i32; 256]) -> [i32; 256] {
32
x.map(|v| v)
43
}

charon/tests/ui/issue-72-hash-missing-impl.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ output=pretty-llbc
21
pub trait Hasher {}
32

43
pub struct DefaultHasher;

charon/tests/ui/issue-73-extern.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ output=pretty-llbc
21
#![feature(extern_types)]
32
extern "C" {
43
fn foo(x: i32);

charon/tests/ui/issue-92-nonpositive-variant-indices.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ output=pretty-llbc
21
enum Ordering {
32
Less = -1,
43
Equal = 0,

charon/tests/ui/issue-97-missing-parent-item-clause.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ output=pretty-llbc
21
pub trait Ord {}
32

43
pub struct AVLTree<T> {

0 commit comments

Comments
 (0)