Module/import upgrades (#4677)

* Parse more import syntax

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Remove unnecessary Vec from VariableDeclaration

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Parse export import

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Factor out an execution module

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* imports: constants, globs, export import

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* test fixups

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2024-12-07 07:16:04 +13:00
committed by GitHub
parent 7af62399ac
commit 30d365aeb3
236 changed files with 103332 additions and 103576 deletions

View File

@ -3,7 +3,7 @@ mod test_examples_someFn {
#[tokio::test(flavor = "multi_thread")]
async fn test_mock_example_someFn0() {
let program = crate::Program::parse_no_errs("someFn()").unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -12,7 +12,7 @@ mod test_examples_someFn {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -22,10 +22,13 @@ mod test_examples_someFn {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_someFn0() {
let code = "someFn()";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_someFn0"),
&result,
@ -44,12 +47,12 @@ pub(crate) struct SomeFn {}
#[doc = "Std lib function: someFn\nDocs"]
pub(crate) const SomeFn: SomeFn = SomeFn {};
fn boxed_someFn(
exec_state: &mut crate::executor::ExecState,
exec_state: &mut crate::ExecState,
args: crate::std::Args,
) -> std::pin::Pin<
Box<
dyn std::future::Future<
Output = anyhow::Result<crate::executor::KclValue, crate::errors::KclError>,
Output = anyhow::Result<crate::execution::KclValue, crate::errors::KclError>,
> + Send
+ '_,
>,

View File

@ -3,7 +3,7 @@ mod test_examples_someFn {
#[tokio::test(flavor = "multi_thread")]
async fn test_mock_example_someFn0() {
let program = crate::Program::parse_no_errs("someFn()").unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -12,7 +12,7 @@ mod test_examples_someFn {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -22,10 +22,13 @@ mod test_examples_someFn {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_someFn0() {
let code = "someFn()";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_someFn0"),
&result,
@ -44,12 +47,12 @@ pub(crate) struct SomeFn {}
#[doc = "Std lib function: someFn\nDocs"]
pub(crate) const SomeFn: SomeFn = SomeFn {};
fn boxed_someFn(
exec_state: &mut crate::executor::ExecState,
exec_state: &mut crate::ExecState,
args: crate::std::Args,
) -> std::pin::Pin<
Box<
dyn std::future::Future<
Output = anyhow::Result<crate::executor::KclValue, crate::errors::KclError>,
Output = anyhow::Result<crate::execution::KclValue, crate::errors::KclError>,
> + Send
+ '_,
>,

View File

@ -4,7 +4,7 @@ mod test_examples_show {
async fn test_mock_example_show0() {
let program =
crate::Program::parse_no_errs("This is another code block.\nyes sirrr.\nshow").unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -13,7 +13,7 @@ mod test_examples_show {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -23,10 +23,13 @@ mod test_examples_show {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_show0() {
let code = "This is another code block.\nyes sirrr.\nshow";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_show0"),
&result,
@ -38,7 +41,7 @@ mod test_examples_show {
async fn test_mock_example_show1() {
let program =
crate::Program::parse_no_errs("This is code.\nIt does other shit.\nshow").unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -47,7 +50,7 @@ mod test_examples_show {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -57,10 +60,13 @@ mod test_examples_show {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_show1() {
let code = "This is code.\nIt does other shit.\nshow";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_show1"),
&result,
@ -79,12 +85,12 @@ pub(crate) struct Show {}
#[doc = "Std lib function: show\nThis is some function.\nIt does shit."]
pub(crate) const Show: Show = Show {};
fn boxed_show(
exec_state: &mut crate::executor::ExecState,
exec_state: &mut crate::ExecState,
args: crate::std::Args,
) -> std::pin::Pin<
Box<
dyn std::future::Future<
Output = anyhow::Result<crate::executor::KclValue, crate::errors::KclError>,
Output = anyhow::Result<crate::execution::KclValue, crate::errors::KclError>,
> + Send
+ '_,
>,

View File

@ -4,7 +4,7 @@ mod test_examples_show {
async fn test_mock_example_show0() {
let program =
crate::Program::parse_no_errs("This is code.\nIt does other shit.\nshow").unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -13,7 +13,7 @@ mod test_examples_show {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -23,10 +23,13 @@ mod test_examples_show {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_show0() {
let code = "This is code.\nIt does other shit.\nshow";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_show0"),
&result,
@ -45,12 +48,12 @@ pub(crate) struct Show {}
#[doc = "Std lib function: show\nThis is some function.\nIt does shit."]
pub(crate) const Show: Show = Show {};
fn boxed_show(
exec_state: &mut crate::executor::ExecState,
exec_state: &mut crate::ExecState,
args: crate::std::Args,
) -> std::pin::Pin<
Box<
dyn std::future::Future<
Output = anyhow::Result<crate::executor::KclValue, crate::errors::KclError>,
Output = anyhow::Result<crate::execution::KclValue, crate::errors::KclError>,
> + Send
+ '_,
>,

View File

@ -5,7 +5,7 @@ mod test_examples_my_func {
let program =
crate::Program::parse_no_errs("This is another code block.\nyes sirrr.\nmyFunc")
.unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -14,7 +14,7 @@ mod test_examples_my_func {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -24,10 +24,13 @@ mod test_examples_my_func {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_my_func0() {
let code = "This is another code block.\nyes sirrr.\nmyFunc";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_my_func0"),
&result,
@ -39,7 +42,7 @@ mod test_examples_my_func {
async fn test_mock_example_my_func1() {
let program =
crate::Program::parse_no_errs("This is code.\nIt does other shit.\nmyFunc").unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -48,7 +51,7 @@ mod test_examples_my_func {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -58,10 +61,13 @@ mod test_examples_my_func {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_my_func1() {
let code = "This is code.\nIt does other shit.\nmyFunc";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_my_func1"),
&result,
@ -80,12 +86,12 @@ pub(crate) struct MyFunc {}
#[doc = "Std lib function: myFunc\nThis is some function.\nIt does shit."]
pub(crate) const MyFunc: MyFunc = MyFunc {};
fn boxed_my_func(
exec_state: &mut crate::executor::ExecState,
exec_state: &mut crate::ExecState,
args: crate::std::Args,
) -> std::pin::Pin<
Box<
dyn std::future::Future<
Output = anyhow::Result<crate::executor::KclValue, crate::errors::KclError>,
Output = anyhow::Result<crate::execution::KclValue, crate::errors::KclError>,
> + Send
+ '_,
>,

View File

@ -5,7 +5,7 @@ mod test_examples_line_to {
let program =
crate::Program::parse_no_errs("This is another code block.\nyes sirrr.\nlineTo")
.unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -14,7 +14,7 @@ mod test_examples_line_to {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -24,10 +24,13 @@ mod test_examples_line_to {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_line_to0() {
let code = "This is another code block.\nyes sirrr.\nlineTo";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_line_to0"),
&result,
@ -39,7 +42,7 @@ mod test_examples_line_to {
async fn test_mock_example_line_to1() {
let program =
crate::Program::parse_no_errs("This is code.\nIt does other shit.\nlineTo").unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -48,7 +51,7 @@ mod test_examples_line_to {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -58,10 +61,13 @@ mod test_examples_line_to {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_line_to1() {
let code = "This is code.\nIt does other shit.\nlineTo";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_line_to1"),
&result,
@ -80,12 +86,12 @@ pub(crate) struct LineTo {}
#[doc = "Std lib function: lineTo\nThis is some function.\nIt does shit."]
pub(crate) const LineTo: LineTo = LineTo {};
fn boxed_line_to(
exec_state: &mut crate::executor::ExecState,
exec_state: &mut crate::ExecState,
args: crate::std::Args,
) -> std::pin::Pin<
Box<
dyn std::future::Future<
Output = anyhow::Result<crate::executor::KclValue, crate::errors::KclError>,
Output = anyhow::Result<crate::execution::KclValue, crate::errors::KclError>,
> + Send
+ '_,
>,

View File

@ -4,7 +4,7 @@ mod test_examples_min {
async fn test_mock_example_min0() {
let program =
crate::Program::parse_no_errs("This is another code block.\nyes sirrr.\nmin").unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -13,7 +13,7 @@ mod test_examples_min {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -23,10 +23,13 @@ mod test_examples_min {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_min0() {
let code = "This is another code block.\nyes sirrr.\nmin";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_min0"),
&result,
@ -38,7 +41,7 @@ mod test_examples_min {
async fn test_mock_example_min1() {
let program =
crate::Program::parse_no_errs("This is code.\nIt does other shit.\nmin").unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -47,7 +50,7 @@ mod test_examples_min {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -57,10 +60,13 @@ mod test_examples_min {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_min1() {
let code = "This is code.\nIt does other shit.\nmin";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_min1"),
&result,
@ -79,12 +85,12 @@ pub(crate) struct Min {}
#[doc = "Std lib function: min\nThis is some function.\nIt does shit."]
pub(crate) const Min: Min = Min {};
fn boxed_min(
exec_state: &mut crate::executor::ExecState,
exec_state: &mut crate::ExecState,
args: crate::std::Args,
) -> std::pin::Pin<
Box<
dyn std::future::Future<
Output = anyhow::Result<crate::executor::KclValue, crate::errors::KclError>,
Output = anyhow::Result<crate::execution::KclValue, crate::errors::KclError>,
> + Send
+ '_,
>,

View File

@ -4,7 +4,7 @@ mod test_examples_show {
async fn test_mock_example_show0() {
let program =
crate::Program::parse_no_errs("This is code.\nIt does other shit.\nshow").unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -13,7 +13,7 @@ mod test_examples_show {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -23,10 +23,13 @@ mod test_examples_show {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_show0() {
let code = "This is code.\nIt does other shit.\nshow";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_show0"),
&result,
@ -45,12 +48,12 @@ pub(crate) struct Show {}
#[doc = "Std lib function: show\nThis is some function.\nIt does shit."]
pub(crate) const Show: Show = Show {};
fn boxed_show(
exec_state: &mut crate::executor::ExecState,
exec_state: &mut crate::ExecState,
args: crate::std::Args,
) -> std::pin::Pin<
Box<
dyn std::future::Future<
Output = anyhow::Result<crate::executor::KclValue, crate::errors::KclError>,
Output = anyhow::Result<crate::execution::KclValue, crate::errors::KclError>,
> + Send
+ '_,
>,

View File

@ -4,7 +4,7 @@ mod test_examples_import {
async fn test_mock_example_import0() {
let program =
crate::Program::parse_no_errs("This is code.\nIt does other shit.\nimport").unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -13,7 +13,7 @@ mod test_examples_import {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -23,10 +23,13 @@ mod test_examples_import {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_import0() {
let code = "This is code.\nIt does other shit.\nimport";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_import0"),
&result,
@ -45,12 +48,12 @@ pub(crate) struct Import {}
#[doc = "Std lib function: import\nThis is some function.\nIt does shit."]
pub(crate) const Import: Import = Import {};
fn boxed_import(
exec_state: &mut crate::executor::ExecState,
exec_state: &mut crate::ExecState,
args: crate::std::Args,
) -> std::pin::Pin<
Box<
dyn std::future::Future<
Output = anyhow::Result<crate::executor::KclValue, crate::errors::KclError>,
Output = anyhow::Result<crate::execution::KclValue, crate::errors::KclError>,
> + Send
+ '_,
>,

View File

@ -4,7 +4,7 @@ mod test_examples_import {
async fn test_mock_example_import0() {
let program =
crate::Program::parse_no_errs("This is code.\nIt does other shit.\nimport").unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -13,7 +13,7 @@ mod test_examples_import {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -23,10 +23,13 @@ mod test_examples_import {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_import0() {
let code = "This is code.\nIt does other shit.\nimport";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_import0"),
&result,
@ -45,12 +48,12 @@ pub(crate) struct Import {}
#[doc = "Std lib function: import\nThis is some function.\nIt does shit."]
pub(crate) const Import: Import = Import {};
fn boxed_import(
exec_state: &mut crate::executor::ExecState,
exec_state: &mut crate::ExecState,
args: crate::std::Args,
) -> std::pin::Pin<
Box<
dyn std::future::Future<
Output = anyhow::Result<crate::executor::KclValue, crate::errors::KclError>,
Output = anyhow::Result<crate::execution::KclValue, crate::errors::KclError>,
> + Send
+ '_,
>,

View File

@ -4,7 +4,7 @@ mod test_examples_import {
async fn test_mock_example_import0() {
let program =
crate::Program::parse_no_errs("This is code.\nIt does other shit.\nimport").unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -13,7 +13,7 @@ mod test_examples_import {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -23,10 +23,13 @@ mod test_examples_import {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_import0() {
let code = "This is code.\nIt does other shit.\nimport";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_import0"),
&result,
@ -45,12 +48,12 @@ pub(crate) struct Import {}
#[doc = "Std lib function: import\nThis is some function.\nIt does shit."]
pub(crate) const Import: Import = Import {};
fn boxed_import(
exec_state: &mut crate::executor::ExecState,
exec_state: &mut crate::ExecState,
args: crate::std::Args,
) -> std::pin::Pin<
Box<
dyn std::future::Future<
Output = anyhow::Result<crate::executor::KclValue, crate::errors::KclError>,
Output = anyhow::Result<crate::execution::KclValue, crate::errors::KclError>,
> + Send
+ '_,
>,

View File

@ -4,7 +4,7 @@ mod test_examples_show {
async fn test_mock_example_show0() {
let program =
crate::Program::parse_no_errs("This is code.\nIt does other shit.\nshow").unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -13,7 +13,7 @@ mod test_examples_show {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -23,10 +23,13 @@ mod test_examples_show {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_show0() {
let code = "This is code.\nIt does other shit.\nshow";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_show0"),
&result,
@ -45,12 +48,12 @@ pub(crate) struct Show {}
#[doc = "Std lib function: show\nThis is some function.\nIt does shit."]
pub(crate) const Show: Show = Show {};
fn boxed_show(
exec_state: &mut crate::executor::ExecState,
exec_state: &mut crate::ExecState,
args: crate::std::Args,
) -> std::pin::Pin<
Box<
dyn std::future::Future<
Output = anyhow::Result<crate::executor::KclValue, crate::errors::KclError>,
Output = anyhow::Result<crate::execution::KclValue, crate::errors::KclError>,
> + Send
+ '_,
>,

View File

@ -3,7 +3,7 @@ mod test_examples_some_function {
#[tokio::test(flavor = "multi_thread")]
async fn test_mock_example_some_function0() {
let program = crate::Program::parse_no_errs("someFunction()").unwrap();
let ctx = crate::executor::ExecutorContext {
let ctx = crate::ExecutorContext {
engine: std::sync::Arc::new(Box::new(
crate::engine::conn_mock::EngineConnection::new()
.await
@ -12,7 +12,7 @@ mod test_examples_some_function {
fs: std::sync::Arc::new(crate::fs::FileManager::new()),
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
settings: Default::default(),
context_type: crate::executor::ContextType::Mock,
context_type: crate::execution::ContextType::Mock,
};
ctx.run(program.into(), &mut crate::ExecState::default())
.await
@ -22,10 +22,13 @@ mod test_examples_some_function {
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
async fn kcl_test_example_some_function0() {
let code = "someFunction()";
let result =
crate::test_server::execute_and_snapshot(code, crate::settings::types::UnitLength::Mm)
.await
.unwrap();
let result = crate::test_server::execute_and_snapshot(
code,
crate::settings::types::UnitLength::Mm,
None,
)
.await
.unwrap();
twenty_twenty::assert_image(
&format!("tests/outputs/{}.png", "serial_test_example_some_function0"),
&result,
@ -44,12 +47,12 @@ pub(crate) struct SomeFunction {}
#[doc = "Std lib function: someFunction\nDocs"]
pub(crate) const SomeFunction: SomeFunction = SomeFunction {};
fn boxed_some_function(
exec_state: &mut crate::executor::ExecState,
exec_state: &mut crate::ExecState,
args: crate::std::Args,
) -> std::pin::Pin<
Box<
dyn std::future::Future<
Output = anyhow::Result<crate::executor::KclValue, crate::errors::KclError>,
Output = anyhow::Result<crate::execution::KclValue, crate::errors::KclError>,
> + Send
+ '_,
>,