mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Dump roc checkmate
This commit is contained in:
parent
1282110ef5
commit
fcd733e1df
8 changed files with 119 additions and 10 deletions
|
@ -27,6 +27,26 @@ macro_rules! debug_checkmate {
|
|||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! dump_checkmate {
|
||||
($opt_collector:expr) => {
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
if let Some(cm) = $opt_collector.as_ref() {
|
||||
$crate::dump_checkmate(cm);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub fn dump_checkmate(collector: &Collector) {
|
||||
let timestamp = chrono::Utc::now().format("%Y%m%d_%H%M%S");
|
||||
let filename = format!("checkmate_{timestamp}.json");
|
||||
let fi = std::fs::File::create(&filename).unwrap();
|
||||
collector.write(fi).unwrap();
|
||||
eprintln!("Wrote checkmate output to {filename}");
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! with_checkmate {
|
||||
({ on => $on:expr, off => $off:expr, }) => {{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue