diff --git a/rust/semi-structured-logs/coverage-annotations.txt b/rust/semi-structured-logs/coverage-annotations.txt new file mode 100644 index 00000000..44398ce8 --- /dev/null +++ b/rust/semi-structured-logs/coverage-annotations.txt @@ -0,0 +1,90 @@ + 1| |/// various log levels + 2| |// #[derive(Clone, PartialEq, Eq, Debug)] + 3| 24|#[derive(Debug)] + ------------------ + | ::fmt: + | 3| 24|#[derive(Debug)] + ------------------ + | Unexecuted instantiation: ::fmt + ------------------ + 4| |pub enum LogLevel { + 5| | Info, + 6| | Warning, + 7| | Error, + 8| | Debug, + 9| |} + 10| | + 11| |/// primary function for emitting logs + 12| 24|pub fn log(level: LogLevel, message: &str) -> String { + 13| 24| // Use the Debug trait to convert the enum to string. + 14| 24| let level_str: String = format!("{level:?}").to_uppercase(); + 15| 24| + 16| 24| // Put the log line together. + 17| 24| let log_line: String = format!("[{level_str}]: {message}"); + 18| 24| + 19| 24| // Return the log line. + 20| 24| log_line + 21| 24|} + ------------------ + | semi_structured_logs::log: + | 12| 24|pub fn log(level: LogLevel, message: &str) -> String { + | 13| 24| // Use the Debug trait to convert the enum to string. + | 14| 24| let level_str: String = format!("{level:?}").to_uppercase(); + | 15| 24| + | 16| 24| // Put the log line together. + | 17| 24| let log_line: String = format!("[{level_str}]: {message}"); + | 18| 24| + | 19| 24| // Return the log line. + | 20| 24| log_line + | 21| 24|} + ------------------ + | Unexecuted instantiation: semi_structured_logs::log + ------------------ + 22| | + 23| 3|pub fn info(message: &str) -> String { + 24| 3| log(LogLevel::Info, message) + 25| 3|} + ------------------ + | semi_structured_logs::info: + | 23| 3|pub fn info(message: &str) -> String { + | 24| 3| log(LogLevel::Info, message) + | 25| 3|} + ------------------ + | Unexecuted instantiation: semi_structured_logs::info + ------------------ + 26| | + 27| 3|pub fn warn(message: &str) -> String { + 28| 3| log(LogLevel::Warning, message) + 29| 3|} + ------------------ + | semi_structured_logs::warn: + | 27| 3|pub fn warn(message: &str) -> String { + | 28| 3| log(LogLevel::Warning, message) + | 29| 3|} + ------------------ + | Unexecuted instantiation: semi_structured_logs::warn + ------------------ + 30| | + 31| 3|pub fn error(message: &str) -> String { + 32| 3| log(LogLevel::Error, message) + 33| 3|} + ------------------ + | semi_structured_logs::error: + | 31| 3|pub fn error(message: &str) -> String { + | 32| 3| log(LogLevel::Error, message) + | 33| 3|} + ------------------ + | Unexecuted instantiation: semi_structured_logs::error + ------------------ + 34| | + 35| 3|pub fn debug(message: &str) -> String { + 36| 3| log(LogLevel::Debug, message) + 37| 3|} + ------------------ + | semi_structured_logs::debug: + | 35| 3|pub fn debug(message: &str) -> String { + | 36| 3| log(LogLevel::Debug, message) + | 37| 3|} + ------------------ + | Unexecuted instantiation: semi_structured_logs::debug + ------------------ \ No newline at end of file diff --git a/rust/semi-structured-logs/coverage-missing-lines.txt b/rust/semi-structured-logs/coverage-missing-lines.txt index 56bf20d6..eb8280b4 100644 --- a/rust/semi-structured-logs/coverage-missing-lines.txt +++ b/rust/semi-structured-logs/coverage-missing-lines.txt @@ -1,3 +1,8 @@ Running: cargo llvm-cov --no-clean --all-features --workspace --show-missing-lines +Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover Branches Missed Branches Cover +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +/home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/src/lib.rs 7 0 100.00% 6 0 100.00% 23 0 100.00% 0 0 - +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +TOTAL 7 0 100.00% 6 0 100.00% 23 0 100.00% 0 0 - diff --git a/rust/semi-structured-logs/report.lcov b/rust/semi-structured-logs/report.lcov new file mode 100644 index 00000000..8cee937c --- /dev/null +++ b/rust/semi-structured-logs/report.lcov @@ -0,0 +1,55 @@ +SF:/home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/src/lib.rs +FN:23,_RNvCsfWXrn5J9T5y_20semi_structured_logs4info +FN:31,_RNvCsfWXrn5J9T5y_20semi_structured_logs5error +FN:27,_RNvCsfWXrn5J9T5y_20semi_structured_logs4warn +FN:35,_RNvCsfWXrn5J9T5y_20semi_structured_logs5debug +FN:3,_RNvXCsfWXrn5J9T5y_20semi_structured_logsNtB2_8LogLevelNtNtCskHJcJaiv42W_4core3fmt5Debug3fmt +FN:12,_RNvCsfWXrn5J9T5y_20semi_structured_logs3log +FN:23,_RNvCslsKOujzi6MT_20semi_structured_logs4info +FN:31,_RNvCslsKOujzi6MT_20semi_structured_logs5error +FN:27,_RNvCslsKOujzi6MT_20semi_structured_logs4warn +FN:3,_RNvXCslsKOujzi6MT_20semi_structured_logsNtB2_8LogLevelNtNtCskHJcJaiv42W_4core3fmt5Debug3fmt +FN:35,_RNvCslsKOujzi6MT_20semi_structured_logs5debug +FN:12,_RNvCslsKOujzi6MT_20semi_structured_logs3log +FNDA:1,_RNvCsfWXrn5J9T5y_20semi_structured_logs4info +FNDA:1,_RNvCsfWXrn5J9T5y_20semi_structured_logs5error +FNDA:1,_RNvCsfWXrn5J9T5y_20semi_structured_logs4warn +FNDA:1,_RNvCsfWXrn5J9T5y_20semi_structured_logs5debug +FNDA:8,_RNvXCsfWXrn5J9T5y_20semi_structured_logsNtB2_8LogLevelNtNtCskHJcJaiv42W_4core3fmt5Debug3fmt +FNDA:8,_RNvCsfWXrn5J9T5y_20semi_structured_logs3log +FNDA:0,_RNvCslsKOujzi6MT_20semi_structured_logs4info +FNDA:0,_RNvCslsKOujzi6MT_20semi_structured_logs5error +FNDA:0,_RNvCslsKOujzi6MT_20semi_structured_logs4warn +FNDA:0,_RNvXCslsKOujzi6MT_20semi_structured_logsNtB2_8LogLevelNtNtCskHJcJaiv42W_4core3fmt5Debug3fmt +FNDA:0,_RNvCslsKOujzi6MT_20semi_structured_logs5debug +FNDA:0,_RNvCslsKOujzi6MT_20semi_structured_logs3log +FNF:6 +FNH:6 +DA:3,8 +DA:12,8 +DA:13,8 +DA:14,8 +DA:15,8 +DA:16,8 +DA:17,8 +DA:18,8 +DA:19,8 +DA:20,8 +DA:21,8 +DA:23,1 +DA:24,1 +DA:25,1 +DA:27,1 +DA:28,1 +DA:29,1 +DA:31,1 +DA:32,1 +DA:33,1 +DA:35,1 +DA:36,1 +DA:37,1 +BRF:0 +BRH:0 +LF:23 +LH:23 +end_of_record \ No newline at end of file diff --git a/rust/semi-structured-logs/run-tests-rust.txt b/rust/semi-structured-logs/run-tests-rust.txt index d325e339..97d5e79d 100644 --- a/rust/semi-structured-logs/run-tests-rust.txt +++ b/rust/semi-structured-logs/run-tests-rust.txt @@ -7,19 +7,22 @@ Running: ../../.github/citools/rust/rust-lint-check --release Running Rust Cargo Check -Running rustc 1.72.0 (5680fa18f 2023-08-23) +Rust version: + + rustc 1.72.0 (5680fa18f 2023-08-23) -=============================================================================== + + ============================================================================== Running: cargo clean -real 0m0.025s -user 0m0.014s -sys 0m0.011s +real 0m0.014s +user 0m0.007s +sys 0m0.007s -=============================================================================== + ============================================================================== Running: cargo check --release @@ -27,21 +30,21 @@ Running: cargo check --release Finished release [optimized] target(s) in 0.12s real 0m0.133s -user 0m0.037s -sys 0m0.028s +user 0m0.026s +sys 0m0.036s -=============================================================================== + ============================================================================== Exit code: 0 -real 0m0.167s -user 0m0.056s -sys 0m0.043s +real 0m0.163s +user 0m0.041s +sys 0m0.051s -real 0m0.169s -user 0m0.057s -sys 0m0.044s +real 0m0.165s +user 0m0.042s +sys 0m0.052s =============================================================================== @@ -49,40 +52,43 @@ Running: ../../.github/citools/rust/rust-lint-clippy --release Running Rust Cargo Clippy -Running rustc 1.72.0 (5680fa18f 2023-08-23) +Rust version: -=============================================================================== + rustc 1.72.0 (5680fa18f 2023-08-23) + + + ============================================================================== Running: cargo clean -real 0m0.008s -user 0m0.005s -sys 0m0.003s +real 0m0.010s +user 0m0.003s +sys 0m0.007s -=============================================================================== + ============================================================================== Running: cargo clippy --release Checking semi_structured_logs v0.1.0 (/home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs) - Finished release [optimized] target(s) in 0.08s + Finished release [optimized] target(s) in 0.18s -real 0m0.116s -user 0m0.069s -sys 0m0.048s +real 0m0.203s +user 0m0.047s +sys 0m0.049s -=============================================================================== + ============================================================================== Exit code: 0 -real 0m0.133s -user 0m0.074s +real 0m0.224s +user 0m0.058s sys 0m0.060s -real 0m0.135s -user 0m0.074s +real 0m0.226s +user 0m0.059s sys 0m0.061s =============================================================================== @@ -90,13 +96,13 @@ sys 0m0.061s Running: ../../.github/citools/rust/rust-lint-audit No deps found, skipping cargo audit. -real 0m0.039s -user 0m0.020s -sys 0m0.019s +real 0m0.037s +user 0m0.013s +sys 0m0.025s -real 0m0.040s -user 0m0.021s -sys 0m0.021s +real 0m0.039s +user 0m0.014s +sys 0m0.026s =============================================================================== @@ -108,24 +114,27 @@ Running: ../../.github/citools/rust/rust-test-with-tarpaulin Running Rust Tests With Tarpaulin -Running rustc 1.72.0 (5680fa18f 2023-08-23) +Rust version: + + rustc 1.72.0 (5680fa18f 2023-08-23) -=============================================================================== + + ============================================================================== Running: cargo clean -real 0m0.009s +real 0m0.008s user 0m0.004s -sys 0m0.005s +sys 0m0.004s -=============================================================================== + ============================================================================== Running: cargo test Compiling semi_structured_logs v0.1.0 (/home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs) - Finished test [unoptimized + debuginfo] target(s) in 0.32s + Finished test [unoptimized + debuginfo] target(s) in 0.30s Running unittests src/lib.rs (target/debug/deps/semi_structured_logs-be8d33af57e41072) running 0 tests @@ -134,15 +143,17 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fini Running tests/semi-structured-logs.rs (target/debug/deps/semi_structured_logs-1afecad563c8a12b) -running 6 tests -test emits_warning ... ok +running 8 tests +test add_a_variant ... ok test emits_error ... ok +test emits_debug ... ok test emits_info ... ok -test log_emits_error ... ok +test emits_warning ... ok test log_emits_info ... ok +test log_emits_error ... ok test log_emits_warning ... ok -test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s +test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s Doc-tests semi_structured_logs @@ -151,64 +162,66 @@ running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s -real 0m0.356s -user 0m0.455s -sys 0m0.220s +real 0m0.333s +user 0m0.384s +sys 0m0.190s -=============================================================================== + ============================================================================== Running: cargo tarpaulin --release --timeout=300 -Aug 28 23:18:29.590  INFO cargo_tarpaulin::config: Creating config -Aug 28 23:18:29.598  INFO cargo_tarpaulin: Running Tarpaulin -Aug 28 23:18:29.598  INFO cargo_tarpaulin: Building project -Aug 28 23:18:29.598  INFO cargo_tarpaulin::cargo: Cleaning project +Aug 29 22:26:29.438  INFO cargo_tarpaulin::config: Creating config +Aug 29 22:26:29.446  INFO cargo_tarpaulin: Running Tarpaulin +Aug 29 22:26:29.446  INFO cargo_tarpaulin: Building project +Aug 29 22:26:29.446  INFO cargo_tarpaulin::cargo: Cleaning project Compiling semi_structured_logs v0.1.0 (/home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs) - Finished release [optimized] target(s) in 0.35s -Aug 28 23:18:29.985  INFO cargo_tarpaulin::process_handling::linux: Launching test -Aug 28 23:18:29.985  INFO cargo_tarpaulin::process_handling: running /home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/target/release/deps/semi_structured_logs-4ea4adcf1478fb48 + Finished release [optimized] target(s) in 0.37s +Aug 29 22:26:29.870  INFO cargo_tarpaulin::process_handling::linux: Launching test +Aug 29 22:26:29.870  INFO cargo_tarpaulin::process_handling: running /home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/target/release/deps/semi_structured_logs-4ea4adcf1478fb48 running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s -Aug 28 23:18:30.508  INFO cargo_tarpaulin::process_handling::linux: Launching test -Aug 28 23:18:30.508  INFO cargo_tarpaulin::process_handling: running /home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/target/release/deps/semi_structured_logs-1b967ddd449a8c23 +Aug 29 22:26:30.364  INFO cargo_tarpaulin::process_handling::linux: Launching test +Aug 29 22:26:30.364  INFO cargo_tarpaulin::process_handling: running /home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/target/release/deps/semi_structured_logs-1b967ddd449a8c23 -running 6 tests +running 8 tests test log_emits_warning ... ok +test log_emits_info ... ok +test log_emits_error ... ok test emits_warning ... ok test emits_info ... ok test emits_error ... ok -test log_emits_info ... ok -test log_emits_error ... ok +test add_a_variant ... ok +test emits_debug ... ok -test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s +test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s -Aug 28 23:18:31.042  INFO cargo_tarpaulin::report: Coverage Results: +Aug 29 22:26:30.877  INFO cargo_tarpaulin::report: Coverage Results: || Uncovered Lines: || Tested/Total Lines: -|| src/lib.rs: 9/9 +|| src/lib.rs: 11/11 || -100.00% coverage, 9/9 lines covered +100.00% coverage, 11/11 lines covered -real 0m1.465s -user 0m0.475s -sys 0m1.093s +real 0m1.455s +user 0m0.516s +sys 0m1.058s -=============================================================================== + ============================================================================== Exit code: 0 -real 0m1.841s -user 0m0.938s -sys 0m1.325s +real 0m1.814s +user 0m0.912s +sys 0m1.264s -real 0m1.842s -user 0m0.939s -sys 0m1.326s +real 0m1.817s +user 0m0.913s +sys 0m1.265s =============================================================================== @@ -216,29 +229,32 @@ Running: ../../.github/citools/rust/rust-test-with-llvm-coverage Running Rust Tests With LLVM Coverage -Running rustc 1.72.0 (5680fa18f 2023-08-23) +Rust version: -=============================================================================== + rustc 1.72.0 (5680fa18f 2023-08-23) + + + ============================================================================== Running: cargo clean -real 0m0.017s -user 0m0.008s -sys 0m0.009s +real 0m0.015s +user 0m0.004s +sys 0m0.011s -=============================================================================== + ============================================================================== Running: cargo llvm-cov clean --workspace -real 0m0.206s -user 0m0.111s -sys 0m0.097s +real 0m0.172s +user 0m0.082s +sys 0m0.092s -=============================================================================== + ============================================================================== Running: cargo test @@ -252,15 +268,17 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fini Running tests/semi-structured-logs.rs (target/debug/deps/semi_structured_logs-1afecad563c8a12b) -running 6 tests -test emits_warning ... ok +running 8 tests +test add_a_variant ... ok +test emits_debug ... ok +test emits_info ... ok test emits_error ... ok -test log_emits_info ... ok +test emits_warning ... ok test log_emits_error ... ok +test log_emits_info ... ok test log_emits_warning ... ok -test emits_info ... ok -test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s +test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s Doc-tests semi_structured_logs @@ -269,146 +287,195 @@ running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s -real 0m0.329s -user 0m0.439s -sys 0m0.182s +real 0m0.332s +user 0m0.409s +sys 0m0.204s -=============================================================================== + ============================================================================== Running: cargo llvm-cov --no-clean --all-features --workspace Compiling semi_structured_logs v0.1.0 (/home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs) -error[E0599]: no variant or associated item named `Debug` found for enum `LogLevel` in the current scope - --> tests/semi-structured-logs.rs:44:23 - | -44 | log(LogLevel::Debug, "reached line 123"), - | ^^^^^ variant or associated item not found in `LogLevel` + Finished test [unoptimized + debuginfo] target(s) in 0.31s + Running unittests src/lib.rs (target/llvm-cov-target/debug/deps/semi_structured_logs-a343e83d2cf10d5a) -For more information about this error, try `rustc --explain E0599`. -error: could not compile `semi_structured_logs` (test "semi-structured-logs") due to previous error -warning: build failed, waiting for other jobs to finish... -error: process didn't exit successfully: `/home/vpayno/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo test --tests --manifest-path /home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/Cargo.toml --target-dir /home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/target/llvm-cov-target --all-features --workspace` (exit status: 101) +running 0 tests -real 0m0.324s -user 0m0.218s -sys 0m0.148s +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running tests/semi-structured-logs.rs (target/llvm-cov-target/debug/deps/semi_structured_logs-37609fd4ae52e28b) -=============================================================================== +running 8 tests +test add_a_variant ... ok +test emits_debug ... ok +test emits_error ... ok +test emits_info ... ok +test emits_warning ... ok +test log_emits_error ... ok +test log_emits_info ... ok +test log_emits_warning ... ok + +test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + +Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover Branches Missed Branches Cover +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +/home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/src/lib.rs 7 0 100.00% 6 0 100.00% 23 0 100.00% 0 0 - +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +TOTAL 7 0 100.00% 6 0 100.00% 23 0 100.00% 0 0 - + +real 0m0.459s +user 0m0.347s +sys 0m0.205s + + + ============================================================================== Running: cargo llvm-cov report --lcov --output-path report.lcov -error: no input files specified. See llvm-profdata merge -help -error: failed to merge profile data: process didn't exit successfully: `/home/vpayno/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata merge -sparse -f /tmp/.tmpTBNmwm -o /home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/target/llvm-cov-target/semi-structured-logs.profdata` (exit status: 1) -real 0m0.102s -user 0m0.056s -sys 0m0.048s + Finished report saved to report.lcov - Compiling semi_structured_logs v0.1.0 (/home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs) -error[E0599]: no variant or associated item named `Debug` found for enum `LogLevel` in the current scope - --> tests/semi-structured-logs.rs:44:23 - | -44 | log(LogLevel::Debug, "reached line 123"), - | ^^^^^ variant or associated item not found in `LogLevel` - -For more information about this error, try `rustc --explain E0599`. -error: could not compile `semi_structured_logs` (test "semi-structured-logs") due to previous error -error: process didn't exit successfully: `/home/vpayno/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo test --tests --manifest-path /home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/Cargo.toml --target-dir /home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/target/llvm-cov-target --all-features --workspace` (exit status: 101) - -real 0m0.167s -user 0m0.099s -sys 0m0.071s +real 0m0.120s +user 0m0.062s +sys 0m0.058s -=============================================================================== + Finished test [unoptimized + debuginfo] target(s) in 0.00s + Running unittests src/lib.rs (target/llvm-cov-target/debug/deps/semi_structured_logs-a343e83d2cf10d5a) + +running 0 tests + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + + Running tests/semi-structured-logs.rs (target/llvm-cov-target/debug/deps/semi_structured_logs-37609fd4ae52e28b) + +running 8 tests +test add_a_variant ... ok +test emits_debug ... ok +test emits_error ... ok +test emits_info ... ok +test emits_warning ... ok +test log_emits_error ... ok +test log_emits_info ... ok +test log_emits_warning ... ok + +test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + + +real 0m0.165s +user 0m0.091s +sys 0m0.073s + + ============================================================================== Running: cargo llvm-cov --no-clean --all-features --workspace --text --output-path=coverage-annotations.txt - Compiling semi_structured_logs v0.1.0 (/home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs) -error[E0599]: no variant or associated item named `Debug` found for enum `LogLevel` in the current scope - --> tests/semi-structured-logs.rs:44:23 - | -44 | log(LogLevel::Debug, "reached line 123"), - | ^^^^^ variant or associated item not found in `LogLevel` + Finished test [unoptimized + debuginfo] target(s) in 0.00s + Running unittests src/lib.rs (target/llvm-cov-target/debug/deps/semi_structured_logs-a343e83d2cf10d5a) -For more information about this error, try `rustc --explain E0599`. -error: could not compile `semi_structured_logs` (test "semi-structured-logs") due to previous error -error: process didn't exit successfully: `/home/vpayno/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo test --tests --manifest-path /home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/Cargo.toml --target-dir /home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/target/llvm-cov-target --all-features --workspace` (exit status: 101) +running 0 tests -real 0m0.155s -user 0m0.087s -sys 0m0.070s +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + Running tests/semi-structured-logs.rs (target/llvm-cov-target/debug/deps/semi_structured_logs-37609fd4ae52e28b) -=============================================================================== +running 8 tests +test add_a_variant ... ok +test emits_debug ... ok +test emits_error ... ok +test emits_info ... ok +test emits_warning ... ok +test log_emits_error ... ok +test log_emits_info ... ok +test log_emits_warning ... ok + +test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s + + + Finished report saved to coverage-annotations.txt + +real 0m0.149s +user 0m0.079s +sys 0m0.071s + + + ============================================================================== Running: cargo llvm-cov clean --workspace -real 0m0.131s -user 0m0.078s -sys 0m0.055s +real 0m0.133s +user 0m0.074s +sys 0m0.061s -=============================================================================== + ============================================================================== Running: lcov --list report.lcov -lcov: ERROR: cannot read file report.lcov! Reading tracefile report.lcov - -real 0m0.043s -user 0m0.039s + |Lines |Functions |Branches +Filename |Rate Num|Rate Num|Rate Num +================================================== +[/home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs/src/] +lib.rs | 100% 23|50.0% 12| - 0 +================================================== + Total:| 100% 23|50.0% 12| - 0 + +real 0m0.037s +user 0m0.032s sys 0m0.004s Running: lcov --summary report.lcov -lcov: ERROR: cannot read file report.lcov! Reading tracefile report.lcov +Summary coverage rate: + lines......: 100.0% (23 of 23 lines) + functions..: 50.0% (6 of 12 functions) + branches...: no data found -real 0m0.032s -user 0m0.027s -sys 0m0.006s +real 0m0.033s +user 0m0.028s +sys 0m0.005s -=============================================================================== + ============================================================================== -Exit code: -6 +Exit code: 0 -real 0m1.521s -user 0m1.169s -sys 0m0.696s +real 0m1.632s +user 0m1.219s +sys 0m0.790s -real 0m1.523s -user 0m1.170s -sys 0m0.697s +real 0m1.634s +user 0m1.221s +sys 0m0.790s =============================================================================== Running: misspell . -real 0m0.034s -user 0m0.025s -sys 0m0.012s +real 0m0.024s +user 0m0.030s +sys 0m0.011s =============================================================================== Running: cargo doc Documenting semi_structured_logs v0.1.0 (/home/vpayno/git_vpayno/exercism-workspace/rust/semi-structured-logs) - Finished dev [unoptimized + debuginfo] target(s) in 0.20s + Finished dev [unoptimized + debuginfo] target(s) in 0.19s -real 0m0.218s -user 0m0.167s -sys 0m0.052s +real 0m0.198s +user 0m0.157s +sys 0m0.041s =============================================================================== Running: cargo clean -real 0m0.012s -user 0m0.005s +real 0m0.016s +user 0m0.009s sys 0m0.007s =============================================================================== diff --git a/rust/semi-structured-logs/src/lib.rs b/rust/semi-structured-logs/src/lib.rs index ec7d54b3..7b225133 100644 --- a/rust/semi-structured-logs/src/lib.rs +++ b/rust/semi-structured-logs/src/lib.rs @@ -5,6 +5,7 @@ pub enum LogLevel { Info, Warning, Error, + Debug, } /// primary function for emitting logs @@ -30,3 +31,7 @@ pub fn warn(message: &str) -> String { pub fn error(message: &str) -> String { log(LogLevel::Error, message) } + +pub fn debug(message: &str) -> String { + log(LogLevel::Debug, message) +} diff --git a/rust/semi-structured-logs/tests/semi-structured-logs.rs b/rust/semi-structured-logs/tests/semi-structured-logs.rs index fc45208c..bc054f59 100644 --- a/rust/semi-structured-logs/tests/semi-structured-logs.rs +++ b/rust/semi-structured-logs/tests/semi-structured-logs.rs @@ -1,4 +1,4 @@ -use semi_structured_logs::{error, info, log, warn, LogLevel}; +use semi_structured_logs::{debug, error, info, log, warn, LogLevel}; #[test] fn emits_info() { @@ -37,7 +37,7 @@ fn log_emits_error() { } #[test] -#[cfg(feature = "add-a-variant")] +// #[cfg(feature = "add-a-variant")] fn add_a_variant() { // this test won't even compile until the enum is complete, which is why it is feature-gated. assert_eq!( @@ -45,3 +45,8 @@ fn add_a_variant() { "[DEBUG]: reached line 123", ); } + +#[test] +fn emits_debug() { + assert_eq!(debug("Disk full"), "[DEBUG]: Disk full"); +}