Skip to content

Commit

Permalink
simplify tokio deps
Browse files Browse the repository at this point in the history
  • Loading branch information
andrieshiemstra committed Sep 16, 2024
1 parent 268ab10 commit d151fde
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.14.0

* simplified tokio dep
* removed tokio_full feature

# 0.13.4

* added rust backtrace to errors generated in rust
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "quickjs_runtime"
version = "0.13.4"
version = "0.14.0"
authors = ["Andries Hiemstra <[email protected]>"]
edition = "2021"
description = "Wrapper API and utils for the QuickJS JavaScript engine with support for Promise, Modules, Async/await"
Expand All @@ -14,7 +14,6 @@ categories = ["development-tools"]

[features]
default = ["console", "setimmediate", "setinterval", "settimeout", "typescript", "bellard"]
tokio_full = ["tokio/full"]
console = []
settimeout = []
setinterval = []
Expand All @@ -31,15 +30,15 @@ hirofa_utils = "0.7"
backtrace = "0.3.67"

#libquickjs-sys = {package="hirofa-quickjs-sys", git='https://github.com/HiRoFa/quickjs-sys'}
#libquickjs-sys = {package="hirofa-quickjs-sys", path='../quickjs-sys'}
#libquickjs-sys = {package="hirofa-quickjs-sys", path='../quickjs-sys', default-features=false}
libquickjs-sys = {package="hirofa-quickjs-sys", version="0.4.0", default-features=false}
lazy_static = "1.4.0"
log = "0.4"
num_cpus = "1"
rand = "0.8"
thread-id = "4"
futures = "0.3"
tokio = {version = "1", features = ["rt-multi-thread", "rt", "bytes", "fs", "io-std", "io-util", "libc", "macros", "time", "tokio-macros", "test-util", "sync", "parking_lot", "mio", "net", "num_cpus"]}
tokio = {version = "1", features=["rt", "rt-multi-thread"]}
serde_json = "1.0"
serde = {version="1.0", features=["derive"]}
string_cache = "0.8"
Expand Down Expand Up @@ -109,6 +108,7 @@ tracing = "0.1"
tracing-log = "0.1"
tracing-gelf = "0.7"
simple-logging = "2.0.2"
tokio = {version = "1", features=["macros"]}

[dev-dependencies.cargo-husky]
version = "1.5.0"
Expand Down
29 changes: 29 additions & 0 deletions src/quickjs_utils/promises.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,35 @@ pub mod tests {
log::info!("< test_promise_reactions");
}

#[tokio::test]
async fn test_promise_async() {
let rt = init_test_rt();
let jsvf = rt
.eval(
None,
Script::new("test_prom_async.js", "Promise.resolve(123)"),
)
.await
.expect("script failed");
if let JsValueFacade::JsPromise { cached_promise } = jsvf {
let res = cached_promise
.get_promise_result()
.await
.expect("promise resolve send code stuf exploded");
match res {
Ok(prom_res) => {
if prom_res.is_i32() {
assert_eq!(prom_res.get_i32(), 123);
} else {
panic!("promise did not resolve to an i32.. well that was unexpected!");
}
}
Err(e) => {
panic!("prom was rejected: {}", e.stringify())
}
}
}
}
#[test]
fn test_promise_nested() {
log::info!("> test_promise_nested");
Expand Down

0 comments on commit d151fde

Please sign in to comment.