Skip to content

Commit 065c964

Browse files
committed
Rename feature gate test to std-stream-captured
1 parent afd0df7 commit 065c964

File tree

6 files changed

+23
-22
lines changed

6 files changed

+23
-22
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
matrix:
6666
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
6767
fn_features: ['', 'log native libsystemd multi-thread runtime-pattern serde serde_json sval']
68-
cfg_feature: ['', 'flexible-string', 'source-location', 'test']
68+
cfg_feature: ['', 'flexible-string', 'source-location', 'std-stream-captured']
6969
runs-on: ${{ matrix.os }}
7070
steps:
7171
- name: Checkout repository

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fmt *ARGS:
1111
test *ARGS:
1212
cargo test \
1313
--features 'log native libsystemd multi-thread runtime-pattern serde serde_json sval' \
14-
--features 'flexible-string source-location test' \
14+
--features 'flexible-string source-location std-stream-captured' \
1515
{{ ARGS }}
1616

1717
clippy *ARGS:

spdlog/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ release-level-info = []
3434
release-level-debug = []
3535
release-level-trace = []
3636

37-
test = []
37+
std-stream-captured = []
3838
source-location = []
3939
native = []
4040
libsystemd = ["dep:libsystemd-sys"]

spdlog/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,9 @@
216216
//!
217217
//! - `serde_json` enables [`formatter::JsonFormatter`].
218218
//!
219-
//! - `test` changes the default behavior of [`StdStreamSink`] to use print
220-
//! macros. See [`StdStreamSinkBuilder::via_print_macro`] for more details.
219+
//! - `std-stream-captured` changes the default behavior of [`StdStreamSink`]
220+
//! to use print macros. See [`StdStreamSinkBuilder::via_print_macro`] for
221+
//! more details.
221222
//!
222223
//! # Supported Rust versions
223224
//!

spdlog/src/sink/std_stream_sink.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ pub struct StdStreamSink {
135135
impl StdStreamSink {
136136
/// Gets a builder of `StdStreamSink` with default parameters:
137137
///
138-
/// | Parameter | Default Value |
139-
/// |-------------------|------------------------------------------------------|
140-
/// | [level_filter] | [`LevelFilter::All`] |
141-
/// | [formatter] | [`FullFormatter`] |
142-
/// | [error_handler] | [`ErrorHandler::default()`] |
143-
/// | | |
144-
/// | [std_stream] | *must be specified* |
145-
/// | [style_mode] | [`StyleMode::Auto`] |
146-
/// | [via_print_macro] | `false`, or `true` if feature gate `test` is enabled |
138+
/// | Parameter | Default Value |
139+
/// |-------------------|---------------------------------------------------------------------|
140+
/// | [level_filter] | [`LevelFilter::All`] |
141+
/// | [formatter] | [`FullFormatter`] |
142+
/// | [error_handler] | [`ErrorHandler::default()`] |
143+
/// | | |
144+
/// | [std_stream] | *must be specified* |
145+
/// | [style_mode] | [`StyleMode::Auto`] |
146+
/// | [via_print_macro] | `false`, or `true` if feature gate `std-stream-captured` is enabled |
147147
///
148148
/// [level_filter]: StdStreamSinkBuilder::level_filter
149149
/// [formatter]: StdStreamSinkBuilder::formatter
@@ -158,7 +158,7 @@ impl StdStreamSink {
158158
prop: SinkProp::default(),
159159
std_stream: (),
160160
style_mode: StyleMode::Auto,
161-
via_print_macro: cfg!(feature = "test"),
161+
via_print_macro: cfg!(feature = "std-stream-captured"),
162162
}
163163
}
164164

@@ -334,7 +334,7 @@ impl<ArgSS> StdStreamSinkBuilder<ArgSS> {
334334
/// test` and `cargo bench`.
335335
///
336336
/// This parameter is **optional**, and defaults to `false`, or defaults to
337-
/// `true` if feature gate `test` is enabled.
337+
/// `true` if feature gate `std-stream-captured` is enabled.
338338
///
339339
/// A convienient way to enable it for `cargo test` and `cargo bench` is to
340340
/// add the following lines to your `Cargo.toml`:
@@ -343,7 +343,7 @@ impl<ArgSS> StdStreamSinkBuilder<ArgSS> {
343343
/// # Note that it's not [dependencies]
344344
///
345345
/// [dev-dependencies]
346-
/// spdlog-rs = { version = "...", features = ["test"] }
346+
/// spdlog-rs = { version = "...", features = ["std-stream-captured"] }
347347
/// ```
348348
///
349349
/// [captured]: https://doc.rust-lang.org/book/ch11-02-running-tests.html#showing-function-output

spdlog/tests/broken_stdio.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
#[cfg(target_os = "linux")]
77
fn main() {
8-
#[cfg(not(feature = "test"))]
8+
#[cfg(not(feature = "std-stream-captured"))]
99
run(); // Should not panic
1010

11-
// Expect this test to panic when the "test" feature is enabled, because we
12-
// intentionally use print macros in `StdStreamSink` for capturing output
13-
// for `cargo test`.
14-
#[cfg(feature = "test")]
11+
// Expect this test to panic when the "std-stream-captured" feature is enabled,
12+
// because we intentionally use print macros in `StdStreamSink` for capturing
13+
// output for `cargo test` and/or `cargo bench`.
14+
#[cfg(feature = "std-stream-captured")]
1515
assert!(std::panic::catch_unwind(run).is_err());
1616

1717
fn run() {

0 commit comments

Comments
 (0)