Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo test fails #20

Open
molenick opened this issue Oct 23, 2024 · 0 comments
Open

cargo test fails #20

molenick opened this issue Oct 23, 2024 · 0 comments

Comments

@molenick
Copy link

Reproduction steps:

  1. Clone repo
  2. cd async-fetcher
  3. cargo test

Results:

-> % cargo test
warning: method `content_length` is never used
   --> src/lib.rs:651:8
    |
650 | trait ResponseExt {
    |       ----------- method in this trait
651 |     fn content_length(&self) -> Option<u64>;
    |        ^^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

   Compiling async-fetcher v0.11.0 (/home/mo/workspace/async-fetcher)
warning: `async-fetcher` (lib) generated 1 warning
warning: `async-fetcher` (lib test) generated 1 warning (1 duplicate)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.40s
     Running unittests src/lib.rs (target/debug/deps/async_fetcher-a33620c4a59480ef)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests async-fetcher

running 2 tests
test src/lib.rs - (line 13) ... FAILED
test src/checksum_system.rs - checksum_system::checksum_stream (line 13) ... FAILED

failures:

---- src/lib.rs - (line 13) stdout ----
error: expected `;`, found `}`
  --> src/lib.rs:35:34
   |
24 |     .stream_from(input_stream, 4)
   |                                  ^ help: add `;` here
25 | } _doctest_main_src_lib_rs_13_0() }
   | - unexpected token

error[E0433]: failed to resolve: use of undeclared type `Fetcher`
 --> src/lib.rs:18:22
  |
7 | let results_stream = Fetcher::default()
  |                      ^^^^^^^ use of undeclared type `Fetcher`
  |
help: consider importing this struct
  |
2 + use async_fetcher::Fetcher;
  |

error[E0433]: failed to resolve: use of undeclared type `Duration`
  --> src/lib.rs:30:14
   |
19 |     .timeout(Duration::from_secs(15))
   |              ^^^^^^^^ use of undeclared type `Duration`
   |
help: consider importing one of these items
   |
2  + use core::time::Duration;
   |
2  + use std::time::Duration;
   |
2  + use tokio::time::Duration;
   |

error[E0425]: cannot find value `input_stream` in this scope
  --> src/lib.rs:35:18
   |
24 |     .stream_from(input_stream, 4)
   |                  ^^^^^^^^^^^^ not found in this scope

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0425, E0433.
For more information about an error, try `rustc --explain E0425`.
Couldn't compile the test.
---- src/checksum_system.rs - checksum_system::checksum_stream (line 13) stdout ----
error[E0425]: cannot find function `checksum_stream` in this scope
 --> src/checksum_system.rs:14:18
  |
3 | let mut stream = checksum_stream(checksums).map(tokio::spawn).buffered(8);
  |                  ^^^^^^^^^^^^^^^ not found in this scope
  |
help: consider importing this function
  |
2 + use async_fetcher::checksum_stream;
  |

error[E0425]: cannot find value `checksums` in this scope
 --> src/checksum_system.rs:14:34
  |
3 | let mut stream = checksum_stream(checksums).map(tokio::spawn).buffered(8);
  |                                  ^^^^^^^^^ not found in this scope

error[E0728]: `await` is only allowed inside `async` functions and blocks
 --> src/checksum_system.rs:15:48
  |
2 | fn main() { #[allow(non_snake_case)] fn _doctest_main_src_checksum_system_rs_13_0() {
  |                                         ----------------------------------------- this is not `async`
3 | let mut stream = checksum_stream(checksums).map(tokio::spawn).buffered(8);
4 | while let Some((path, result)) = stream.next().await {
  |                                                ^^^^^ only allowed inside `async` functions and blocks

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0425, E0728.
For more information about an error, try `rustc --explain E0425`.
Couldn't compile the test.

failures:
    src/checksum_system.rs - checksum_system::checksum_stream (line 13)
    src/lib.rs - (line 13)

test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant