Modules should be registered in luby not lb
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
use lb::runtime;
|
||||
use luaify::luaify;
|
||||
use luajit::{Chunk, LoadMode};
|
||||
use tokio::test;
|
||||
|
||||
async fn run_lua(s: &'static str) {
|
||||
let rt = runtime::Builder::new().build().unwrap();
|
||||
let task = rt.spawn(async move |state| {
|
||||
println!("executing test chunk: {s}");
|
||||
|
||||
state
|
||||
.load(Chunk::new(s).mode(LoadMode::TEXT))
|
||||
.unwrap_or_else(|err| panic!("{err}"));
|
||||
|
||||
state
|
||||
.call_async(0, 0)
|
||||
.await
|
||||
.unwrap_or_else(|err| panic!("{err}"));
|
||||
});
|
||||
|
||||
rt.await;
|
||||
task.await.unwrap_or_else(|err| panic!("{err}"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
async fn ipaddr() {
|
||||
run_lua(luaify!({
|
||||
let net = require("lb:net");
|
||||
print(net.ipaddr("127.0.0.1"));
|
||||
}))
|
||||
.await
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
use lb::runtime;
|
||||
use luaify::luaify;
|
||||
use luajit::{Chunk, LoadMode};
|
||||
use tokio::test;
|
||||
|
||||
async fn run_lua(s: &'static str) {
|
||||
let rt = runtime::Builder::new().build().unwrap();
|
||||
let task = rt.spawn(async move |state| {
|
||||
println!("executing test chunk: {s}");
|
||||
|
||||
state
|
||||
.load(Chunk::new(s).mode(LoadMode::TEXT))
|
||||
.unwrap_or_else(|err| panic!("{err}"));
|
||||
|
||||
state
|
||||
.call_async(0, 0)
|
||||
.await
|
||||
.unwrap_or_else(|err| panic!("{err}"));
|
||||
});
|
||||
|
||||
rt.await;
|
||||
task.await.unwrap_or_else(|err| panic!("{err}"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
async fn task_test() {
|
||||
run_lua(luaify!({
|
||||
let thing = spawn(|| {
|
||||
print("spawn callback!!!!!!!!!!!!!");
|
||||
});
|
||||
print("thing is", thing);
|
||||
//
|
||||
}))
|
||||
.await
|
||||
}
|
||||
Reference in New Issue
Block a user