Skip to content

Commit ceb8c28

Browse files
committed
Make tests actually make sense
1 parent 501ec52 commit ceb8c28

6 files changed

+40
-50
lines changed

tests/structs/src/debug_derive.c

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//! derive:Debug
2+
3+
#include <stdarg.h>
4+
5+
typedef struct {
6+
int a;
7+
} Debuggable1;
8+
9+
typedef struct {
10+
va_list v;
11+
} Debuggable2;
12+
13+
Debuggable1 *kDebuggable1;
14+
Debuggable2 *kDebuggable2;
15+
16+
// A struct containing a union cannot derive Debug, so make
17+
// sure we don't generate a #[derive] for it
18+
typedef struct {
19+
struct {
20+
struct {
21+
union {
22+
int d;
23+
float e;
24+
} c;
25+
} b;
26+
} a;
27+
} NotDebuggable1;
28+
29+
NotDebuggable1 kNotDebuggable1;

tests/structs/src/debug_derive_bad.c

-15
This file was deleted.

tests/structs/src/debug_derive_good.c

-14
This file was deleted.
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//! feature_c_variadic
2+
3+
use crate::debug_derive::{rust_kDebuggable1, rust_kDebuggable2};
4+
use std::fmt::Debug;
5+
6+
pub fn test_debuggable() {
7+
unsafe {
8+
// Make sure all debuggable structs implement `Debug`
9+
let _debuggable: Vec<*mut dyn Debug> = vec![rust_kDebuggable1, rust_kDebuggable2];
10+
}
11+
}

tests/structs/src/test_debug_derive_bad.rs

-10
This file was deleted.

tests/structs/src/test_debug_derive_good.rs

-11
This file was deleted.

0 commit comments

Comments
 (0)