Skip to content

Commit 6233e80

Browse files
committed
refactor: tests: port reconstruct_for_range to a snapshot test
It appears this test is now broken as it panics. I still added the snapshot that should be expected based on the `new.rs` file.
1 parent c33e46b commit 6233e80

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

c2rust-refactor/tests/reconstruct_for_range/run.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

c2rust-refactor/tests/snapshots.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,18 @@ fn test_matcher_typed() {
289289
.test();
290290
}
291291

292+
/// TODO Broken.
293+
/// This panics with the error:
294+
///
295+
/// ```shell
296+
/// thread 'rustc' panicked at 'Could not find an HIR id for NodeId NodeId(61); span=Some(NodeSpan { span: Span { lo: BytePos(237), hi: BytePos(325), ctxt: #0 }, kind: Stmt }), context=Some(NodeContextKey { stmt_index: Some(6), child_path: [], symbol: None, owner: Some(NodeId(8)) })', c2rust-refactor/src/context.rs:927:13
297+
/// ```
298+
#[should_panic]
299+
#[test]
300+
fn test_reconstruct_for_range() {
301+
refactor("reconstruct_for_range").test();
302+
}
303+
292304
#[test]
293305
fn test_reconstruct_while() {
294306
refactor("reconstruct_while").test();
File renamed without changes.

c2rust-refactor/tests/reconstruct_for_range/new.rs renamed to c2rust-refactor/tests/snapshots/snapshots__refactor-reconstruct_for_range.rs.snap

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
---
2+
source: c2rust-refactor/tests/snapshots.rs
3+
expression: c2rust-refactor reconstruct_for_range --rewrite-mode alongside -- tests/snapshots/reconstruct_for_range.rs --edition 2021
4+
---
15
fn main() {
26
let (mut i, mut j, mut k);
3-
7+
48
'a: for i in 0..10 {
59
println!("{}", i);
610
}

0 commit comments

Comments
 (0)