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

Adds a nickel test subcommand for testing examples in docs. #2020

Merged
merged 11 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ bench = false
[features]
default = ["repl", "doc", "format", "spanned-deser"]
repl = ["nickel-lang-core/repl"]
doc = ["nickel-lang-core/doc"]
doc = ["nickel-lang-core/doc", "comrak"]
format = ["nickel-lang-core/format", "dep:tempfile"]
spanned-deser = ["nickel-lang-core/spanned-deser"]
metrics = ["dep:metrics", "dep:metrics-util", "nickel-lang-core/metrics"]
Expand All @@ -38,6 +38,10 @@ clap_complete = { workspace = true }
metrics = { workspace = true, optional = true }
metrics-util = { workspace = true, optional = true }

comrak = { workspace = true, optional = true }
once_cell.workspace = true
regex.workspace = true

[dev-dependencies]
nickel-lang-utils.workspace = true
test-generator.workspace = true
Expand Down
9 changes: 6 additions & 3 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use nickel_lang_core::error::report::ErrorFormat;
use crate::repl::ReplCommand;

#[cfg(feature = "doc")]
use crate::doc::DocCommand;
use crate::{doc::DocCommand, doctest::TestCommand};

#[cfg(feature = "format")]
use crate::format::FormatCommand;
Expand Down Expand Up @@ -63,7 +63,7 @@ pub struct GlobalOptions {
/// Available subcommands.
#[derive(clap::Subcommand, Debug)]
pub enum Command {
/// Evaluate a Nickel program and pretty-print the result.
/// Evaluates a Nickel program and pretty-prints the result.
Eval(EvalCommand),
/// Converts the parsed representation (AST) back to Nickel source code and
/// prints it. Used for debugging purpose
Expand All @@ -72,14 +72,17 @@ pub enum Command {
Export(ExportCommand),
/// Prints the metadata attached to an attribute, given as a path
Query(QueryCommand),
/// Typechecks the program but do not run it
/// Typechecks the program but does not run it
Typecheck(TypecheckCommand),
/// Starts a REPL session
#[cfg(feature = "repl")]
Repl(ReplCommand),
/// Generates the documentation files for the specified nickel file
#[cfg(feature = "doc")]
Doc(DocCommand),
/// Tests the documentation examples in the specified nickel file
#[cfg(feature = "doc")]
Test(TestCommand),
/// Format Nickel files
#[cfg(feature = "format")]
Format(FormatCommand),
Expand Down
Loading