1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! External-context check for `ktstr::__private::{ctor, serde_json}`.
//!
//! The `#[ktstr_test]` proc macro emits a
//! `#[::ktstr::__private::linkme::distributed_slice(::ktstr::test_support::KTSTR_TESTS)]`
//! static of type `KtstrTestEntry` that registers the test in the
//! `KTSTR_TESTS` distributed slice at link time. The `__private::ctor`
//! and `__private::serde_json` re-exports are used by test-author
//! code (e.g. `tests/jemalloc_probe_tests.rs` attaches `#[ctor::ctor]`
//! via the re-export to set env vars before the test harness runs;
//! downstream consumers reach for `__private::serde_json` to parse
//! sidecar output without listing `serde_json` as a direct dep).
//!
//! If any of these re-exports change path or disappear, downstream
//! crates that depend on the surface fail to compile. This file
//! exercises both paths directly from external test code — i.e.
//! treating `ktstr` as a dev-dependency — so a silent regression in
//! the private re-export surface would fail this binary's build
//! before the broader integration suite runs.
//!
//! The assertions live inside a plain `#[test]` because this file
//! holds no `#[ktstr_test]` entries. Confirm both paths resolve, can
//! be invoked, and produce the same behavior that the macro
//! expansion relies on.
use __private;
/// `serde_json::to_string` must be reachable through the re-export
/// and must serialize a simple structure the same way the top-level
/// `serde_json` crate would.
/// `serde_json::from_str` is used by downstream consumers reading
/// sidecar output. Roundtrip a value through `__private::serde_json`
/// both directions to prove the re-export exposes the full crate,
/// not just a subset.
/// `__private::ctor` must expose the `#[ctor]` attribute macro used by
/// the test-flag registration path. Attach it here via the fully
/// qualified re-export path (matching the macro's emission style) and
/// observe its side effect — the ctor fires before `#[test]` runs,
/// so by the time the test body executes, the static has been
/// initialized.
static INIT_FIRED: AtomicBool = new;