Skip to content

Commit 4b96171

Browse files
authored
refactor: tests: add remaining tests with one command and arguments (#1615)
2 parents 4f4e9c0 + c7e6f6e commit 4b96171

13 files changed

+69
-50
lines changed

c2rust-refactor/tests/bitcast_retype/run.sh

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

c2rust-refactor/tests/matcher_def/new.rs

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

c2rust-refactor/tests/matcher_def/run.sh

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

c2rust-refactor/tests/matcher_typed/new.rs

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

c2rust-refactor/tests/matcher_typed/run.sh

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

c2rust-refactor/tests/snapshots.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,13 @@ fn test_refactor(
216216

217217
// NOTE: Tests should be listed in alphabetical order.
218218

219+
#[test]
220+
fn test_bitcast_retype() {
221+
refactor("bitcast_retype")
222+
.command_args(&["i32", "u32"])
223+
.test();
224+
}
225+
219226
#[test]
220227
fn test_convert_exits() {
221228
refactor("convert_exits").test();
@@ -250,6 +257,24 @@ fn test_fold_let_assign() {
250257
refactor("fold_let_assign").test();
251258
}
252259

260+
#[test]
261+
fn test_matcher_def() {
262+
refactor("rewrite_expr")
263+
.command_args(&["def!(crate::f)()", "crate::f2()"])
264+
.named("matcher_def.rs")
265+
.test()
266+
}
267+
268+
/// TODO Broken.
269+
/// `b: u16` is not replaced with `1000u16`.
270+
#[test]
271+
fn test_matcher_typed() {
272+
refactor("rewrite_expr")
273+
.command_args(&["typed!($i:Ident, u16)", "1000u16"])
274+
.named("matcher_typed.rs")
275+
.test();
276+
}
277+
253278
#[test]
254279
fn test_reconstruct_while() {
255280
refactor("reconstruct_while").test();
File renamed without changes.
File renamed without changes.
File renamed without changes.

c2rust-refactor/tests/bitcast_retype/new.rs renamed to c2rust-refactor/tests/snapshots/snapshots__refactor-bitcast_retype.rs-i32-u32.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
source: c2rust-refactor/tests/snapshots.rs
3+
expression: c2rust-refactor bitcast_retype i32 u32 --rewrite-mode alongside -- tests/snapshots/bitcast_retype.rs --edition 2021
4+
---
15
struct S {
26
x: u32,
37
}

0 commit comments

Comments
 (0)