Skip to content

Commit

Permalink
ui tests: Make pretty-llbc the default behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Apr 12, 2024
1 parent 40fd5df commit 7e58ea8
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 15 deletions.
11 changes: 3 additions & 8 deletions charon/tests/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ enum TestKind {
KnownFailure,
KnownPanic,
Skip,
Unspecified,
}

struct MagicComments {
Expand All @@ -40,7 +39,7 @@ struct MagicComments {

static HELP_STRING: &str = unindent!(
"Options are:
- `//@ output=pretty-llbc`: record the pretty-printed llbc;
- `//@ output=pretty-llbc`: record the pretty-printed llbc (default);
- `//@ known-failure`: a test that is expected to fail.
- `//@ known-panic`: a test that is expected to panic.
- `//@ skip`: skip the test.
Expand All @@ -56,7 +55,7 @@ static HELP_STRING: &str = unindent!(
fn parse_magic_comments(input_path: &std::path::Path) -> anyhow::Result<MagicComments> {
// Parse the magic comments.
let mut comments = MagicComments {
test_kind: TestKind::Unspecified,
test_kind: TestKind::PrettyLlbc,
cli_opts: CliOpts::default(),
check_output: true,
auxiliary_crates: Vec::new(),
Expand Down Expand Up @@ -141,10 +140,6 @@ fn path_to_crate_name(path: &Path) -> Option<String> {
}

fn perform_test(test_case: &Case, action: Action) -> anyhow::Result<()> {
if matches!(test_case.magic_comments.test_kind, TestKind::Unspecified) {
bail!("Test must start with a magic comment that determines its kind. {HELP_STRING}");
}

// Dependencies
// Vec of (crate name, path to crate.rs, path to libcrate.rlib).
let deps: Vec<(String, PathBuf, String)> = test_case
Expand Down Expand Up @@ -216,7 +211,7 @@ fn perform_test(test_case: &Case, action: Action) -> anyhow::Result<()> {
bail!("Compilation failed: {stderr}")
}
}
TestKind::Skip | TestKind::Unspecified => unreachable!(),
TestKind::Skip => unreachable!(),
}
if test_case.magic_comments.check_output {
let actual = snapbox::Data::text(stderr).map_text(snapbox::utils::normalize_lines);
Expand Down
1 change: 0 additions & 1 deletion charon/tests/ui/issue-118-generic-copy.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ output=pretty-llbc
#![allow(unused)]

#[derive(Clone, Copy)]
Expand Down
1 change: 0 additions & 1 deletion charon/tests/ui/issue-4-traits.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ output=pretty-llbc
use std::convert::TryInto;
fn trait_error(s: &[u8]) {
let _array: [u8; 4] = s.try_into().unwrap();
Expand Down
1 change: 0 additions & 1 deletion charon/tests/ui/issue-45-misc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ output=pretty-llbc
pub fn map(x: [i32; 256]) -> [i32; 256] {
x.map(|v| v)
}
Expand Down
1 change: 0 additions & 1 deletion charon/tests/ui/issue-72-hash-missing-impl.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ output=pretty-llbc
pub trait Hasher {}

pub struct DefaultHasher;
Expand Down
1 change: 0 additions & 1 deletion charon/tests/ui/issue-73-extern.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ output=pretty-llbc
#![feature(extern_types)]
extern "C" {
fn foo(x: i32);
Expand Down
1 change: 0 additions & 1 deletion charon/tests/ui/issue-92-nonpositive-variant-indices.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ output=pretty-llbc
enum Ordering {
Less = -1,
Equal = 0,
Expand Down
1 change: 0 additions & 1 deletion charon/tests/ui/issue-97-missing-parent-item-clause.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ output=pretty-llbc
pub trait Ord {}

pub struct AVLTree<T> {
Expand Down

0 comments on commit 7e58ea8

Please sign in to comment.