Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit 3105ed6

Browse files
author
Hendrik van Antwerpen
committed
Add flag to disable builtins
1 parent 2affd6e commit 3105ed6

File tree

1 file changed

+9
-2
lines changed
  • tree-sitter-stack-graphs/src/cli

1 file changed

+9
-2
lines changed

tree-sitter-stack-graphs/src/cli/test.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ pub struct TestArgs {
129129
default_value_t = OutputMode::OnFailure,
130130
)]
131131
pub output_mode: OutputMode,
132+
133+
/// Do not load builtins for tests.
134+
#[clap(long)]
135+
pub no_builtins: bool,
132136
}
133137

134138
/// Flag to control output
@@ -158,6 +162,7 @@ impl TestArgs {
158162
save_paths: None,
159163
save_visualization: None,
160164
output_mode: OutputMode::OnFailure,
165+
no_builtins: false,
161166
}
162167
}
163168

@@ -229,8 +234,10 @@ impl TestArgs {
229234

230235
let default_fragment_path = test_path.strip_prefix(test_root).unwrap();
231236
let mut test = Test::from_source(&test_path, &source, default_fragment_path)?;
232-
self.load_builtins_into(&lc, &mut test.graph)
233-
.with_context(|| format!("Loading builtins into {}", test_path.display()))?;
237+
if !self.no_builtins {
238+
self.load_builtins_into(&lc, &mut test.graph)
239+
.with_context(|| format!("Loading builtins into {}", test_path.display()))?;
240+
}
234241
let mut globals = Variables::new();
235242
for test_fragment in &test.fragments {
236243
if let Some(fa) = test_fragment

0 commit comments

Comments
 (0)