mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-09 09:29:44 -06:00
Variables: Lock Variables' description names the refused import
variable.lock's params text and the doc comment on Variables::locked said every dataset command still runs while the variables are locked. dataset.import is refused when its header would define a variable; both texts now say so, as docs/mcp.md and dataset.import's params already do.
This commit is contained in:
@@ -117,7 +117,8 @@ pub struct Variables {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub active_dataset: Option<String>,
|
||||
/// Lock Variables: while set, variables can't be defined, deleted or renamed. Objects can
|
||||
/// still be bound to them and unbound, and datasets still change and apply.
|
||||
/// still be bound to them and unbound, and datasets still change and apply, except that an
|
||||
/// import whose header would define a variable is refused.
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub locked: bool,
|
||||
}
|
||||
|
||||
@@ -641,7 +641,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Lock Variables",
|
||||
["Window", "Variables"],
|
||||
None,
|
||||
"{locked?: bool} lock or unlock the variables (default: toggle); saved with the document; a change is one undo step. While locked, variable.define, variable.delete, variable.rename, variable.make…Dynamic and a variable.loadLibrary that would delete or define a variable are refused; binding, unbinding and the dataset commands still run → {locked}",
|
||||
"{locked?: bool} lock or unlock the variables (default: toggle); saved with the document; a change is one undo step. While locked, variable.define, variable.delete, variable.rename, variable.make…Dynamic and a variable.loadLibrary that would delete or define a variable are refused; binding, unbinding and the dataset commands still run, except a dataset.import whose header would define a variable → {locked}",
|
||||
has_doc,
|
||||
lock
|
||||
),
|
||||
|
||||
@@ -409,7 +409,8 @@ fn make_dynamic_errors_name_the_command() {
|
||||
}
|
||||
|
||||
/// Lock Variables refuses defining, deleting and renaming variables, Make … Dynamic included,
|
||||
/// while binding, unbinding and the dataset commands still run.
|
||||
/// while binding, unbinding and the dataset commands still run (an import that would define a
|
||||
/// variable is refused; see `locked_variables_refuse_header_cells_that_define_variables`).
|
||||
#[test]
|
||||
fn locked_variables_refuse_new_deleted_and_renamed_variables() {
|
||||
let mut s = session();
|
||||
@@ -1324,6 +1325,14 @@ fn locked_variables_refuse_header_cells_that_define_variables() {
|
||||
assert_eq!(imp["defined"], json!(["New"]));
|
||||
}
|
||||
|
||||
/// `variable.lock`'s params text names the dataset command it refuses: an import whose header
|
||||
/// would define a variable.
|
||||
#[test]
|
||||
fn the_lock_params_text_names_the_refused_import() {
|
||||
let params = cmd::find_command("variable.lock").unwrap().params;
|
||||
assert!(params.contains("the dataset commands still run, except a dataset.import whose header would define a variable"), "{params}");
|
||||
}
|
||||
|
||||
/// Import / export datasets as CSV: header `name` then variables; round-trip keeps values.
|
||||
#[test]
|
||||
fn datasets_csv_round_trips_and_rejects_bad_input() {
|
||||
|
||||
Reference in New Issue
Block a user