Skip to content

Commit 963946f

Browse files
committed
test: fix examples & add more edge cases
1 parent 7377d1d commit 963946f

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

examples/async.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
use pistones::{lang::Response, Client, Error};
1+
use pistones::{Client, Error};
22

33
#[tokio::main]
44
async fn main() -> Result<(), Error> {
5-
let response = compile_code("rust", "fn main() { println!(\"Hola\") }").await?;
6-
println("{response:?}");
7-
Ok(())
8-
}
9-
10-
async fn compile_code(lang: &str, code: &str) -> Result<Response, Error> {
115
let client = Client::new().await?.user_agent("@romancitodev")?;
12-
client.run(lang, code).await
6+
7+
tokio::spawn(async move {
8+
let _ = client
9+
.run("rust", "fn main() { println!(\"Hola\") }")
10+
.await
11+
.unwrap();
12+
});
13+
14+
println!("hello!");
15+
Ok(())
1316
}

examples/refresh_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use pistones::{Client, Error};
33
#[tokio::main]
44
async fn main() -> Result<(), Error> {
55
// Normal client
6-
let client = Client::new().await?;
6+
let _ = Client::new().await?;
77
// Create client with cache disabled
88
let client = Client::new().await?.disable_cache();
99

0 commit comments

Comments
 (0)