Skip to content

Commit

Permalink
db: fix tests not working with miri interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed May 2, 2024
1 parent 7acd888 commit 5beb6fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/db_tutorial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
- run: cargo test
ub-check:
runs-on: ubuntu-latest
env:
MIRIFLAGS: -Zmiri-disable-isolation
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
Expand Down
8 changes: 8 additions & 0 deletions db_tutorial/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,21 @@ fn main() -> io::Result<()> {
#[rustfmt::skip::macros(format)]
mod tests {
use super::*;
#[cfg(not(miri))]
use insta::assert_snapshot;
use std::fmt::Write as _;
use std::io::BufReader;
use std::path::PathBuf;
use std::sync::OnceLock;
use tempfile::TempDir;

#[cfg(miri)]
macro_rules! assert_snapshot {
($arg:expr) => {
let _ = $arg;
};
}

#[track_caller]
fn run_test_with_table(stdin: impl AsRef<str>, table: Table) -> io::Result<String> {
let stdin = stdin.as_ref();
Expand Down

0 comments on commit 5beb6fa

Please sign in to comment.