Make most top-level modules in KCL private (#4478)
* Make ast module private Signed-off-by: Nick Cameron <nrc@ncameron.org> * Make most other modules private Signed-off-by: Nick Cameron <nrc@ncameron.org> * Expand API to support CLI, Python bindings, and LSP crate Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -3,9 +3,7 @@ mod test_examples_my_func {
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn test_mock_example_my_func0() {
|
||||
let program =
|
||||
crate::parser::top_level_parse("This is another code block.\nyes sirrr.\nmyFunc")
|
||||
.unwrap();
|
||||
let id_generator = crate::executor::IdGenerator::default();
|
||||
crate::Program::parse("This is another code block.\nyes sirrr.\nmyFunc").unwrap();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn_mock::EngineConnection::new()
|
||||
@ -17,7 +15,9 @@ mod test_examples_my_func {
|
||||
settings: Default::default(),
|
||||
context_type: crate::executor::ContextType::Mock,
|
||||
};
|
||||
ctx.run(&program, None, id_generator, None).await.unwrap();
|
||||
ctx.run(&program, &mut crate::ExecState::default())
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||
@ -36,9 +36,7 @@ mod test_examples_my_func {
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn test_mock_example_my_func1() {
|
||||
let program =
|
||||
crate::parser::top_level_parse("This is code.\nIt does other shit.\nmyFunc").unwrap();
|
||||
let id_generator = crate::executor::IdGenerator::default();
|
||||
let program = crate::Program::parse("This is code.\nIt does other shit.\nmyFunc").unwrap();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn_mock::EngineConnection::new()
|
||||
@ -50,7 +48,9 @@ mod test_examples_my_func {
|
||||
settings: Default::default(),
|
||||
context_type: crate::executor::ContextType::Mock,
|
||||
};
|
||||
ctx.run(&program, None, id_generator, None).await.unwrap();
|
||||
ctx.run(&program, &mut crate::ExecState::default())
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||
@ -149,10 +149,10 @@ impl crate::docs::StdLibFn for MyFunc {
|
||||
code_blocks
|
||||
.iter()
|
||||
.map(|cb| {
|
||||
let program = crate::parser::top_level_parse(cb).unwrap();
|
||||
let program = crate::Program::parse(cb).unwrap();
|
||||
let mut options: crate::ast::types::FormatOptions = Default::default();
|
||||
options.insert_final_newline = false;
|
||||
program.recast(&options, 0)
|
||||
program.ast.recast(&options, 0)
|
||||
})
|
||||
.collect::<Vec<String>>()
|
||||
}
|
||||
|
Reference in New Issue
Block a user