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

feat: re-export tokio runtime #3

Merged
merged 1 commit into from
Oct 12, 2022
Merged

feat: re-export tokio runtime #3

merged 1 commit into from
Oct 12, 2022

Conversation

duyet
Copy link
Contributor

@duyet duyet commented Oct 12, 2022

use deno_runner::{Builder, Runtime};
use std::collections::HashMap;

#[test]
fn test_tokio_runtime() {
    // Using re-exported tokio runtime
    let rt = Runtime::new().unwrap();
    let out = rt.block_on(async {
        let custom_code = r#"
            const add = (a, b) => a + b;
            add(a, b)
        "#;

        let runner = Builder::new().build();
        let vars = HashMap::from([("a", 1), ("b", 2)]);
        let result = runner.run(custom_code, Some(vars)).await.unwrap();

        result
    });

    assert_eq!(out, "3");
}

@codecov-commenter
Copy link

codecov-commenter commented Oct 12, 2022

Codecov Report

Base: 99.13% // Head: 99.13% // No change to project coverage 👍

Coverage data is based on head (d5654a0) compared to base (1463e41).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##           master       #3   +/-   ##
=======================================
  Coverage   99.13%   99.13%           
=======================================
  Files           1        1           
  Lines         116      116           
=======================================
  Hits          115      115           
  Misses          1        1           
Impacted Files Coverage Δ
src/lib.rs 99.13% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@duyet duyet merged commit fe33a68 into master Oct 12, 2022
@duyet duyet deleted the feat/re-export-runtime branch October 12, 2022 09:44
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

Successfully merging this pull request may close these issues.

2 participants