mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 16:02:28 +00:00
0317d5891c
* feat: add powershell common parameters support (-Verbose, -Debug, -ErrorAction, -WhatIf) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add powershell common params to script editor test panel Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: detect CmdletBinding from code instead of schema in script editor Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: ignore commented-out CmdletBinding in powershell detection Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use preference variables for -Verbose/-Debug instead of CLI args Verbose/Debug output goes to PowerShell stream 4/5 which isn't captured by the 2>&1 redirect. Setting $VerbosePreference/$DebugPreference in the wrapper scope propagates to child scripts and output flows through the host to stderr, which Windmill captures as logs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use *>&1 to capture all powershell streams including verbose/debug The previous 2>&1 only captured error stream. Verbose (stream 4) and debug (stream 5) output was silently lost. Using *>&1 redirects all streams to success stream so they flow through Tee-Object into logs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use targeted stream redirects (4>&1 5>&1 2>&1) instead of *>&1 *>&1 breaks $PSCmdlet.ShouldProcess() by redirecting internal streams. Only redirect verbose (4), debug (5), and error (2) to success stream. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: revert to 2>&1 redirect — stream 4/5 redirects break powershell Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use 4>&1 5>&1 for verbose/debug capture, remove WhatIf support Stream 4/5 redirects capture verbose/debug in the pipeline. WhatIf is removed because $PSCmdlet.ShouldProcess() doesn't work when scripts are invoked through Windmill's wrapper. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: redirect verbose/debug to files to keep result pipeline clean Verbose (4) and debug (5) streams are redirected to separate log files during script execution, then output via Write-Host after the script completes. This keeps them out of the Tee-Object pipeline (used for result extraction) while still showing them in the job logs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: output verbose/debug to stderr via Console.Error for log capture Write-Host goes to stdout which gets mixed with result output and truncated by OSS log threshold. Using [Console]::Error.WriteLine() writes to stderr which Windmill captures separately as logs, with VERBOSE:/DEBUG: prefixes for clarity. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: redirect script output to file only, send verbose/debug to stdout The OSS log storage has a 9KB threshold. Previously, Tee-Object sent the full JSON result to both stdout (logs) and the pipe file, eating the log budget. Now script output goes only to the pipe file (> $pipe), and only verbose/debug messages go to stdout for the log viewer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: preserve original Tee-Object behavior, append verbose/debug after Keep the original wrapper behavior (Tee-Object to stdout + pipe file). Only add 4>verbose.log 5>debug.log to capture those streams, and output them at the end of logs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: inject preference vars into main.ps1 instead of CLI args Passing -Verbose/-Debug as CLI args causes PowerShell module loading to emit verbose noise. Instead, inject $VerbosePreference/$DebugPreference inside main.ps1's try block so they only affect user code. Stream 4/5 are still redirected to files in the wrapper for log output. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: restore common param toggles from previous job args on Run Again Extract _wm_ps_* keys from loaded args and initialize the toggle states in PowerShellCommonParams. Also strip them from main args so they don't appear as unknown schema form inputs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: show active common param badges when section is collapsed Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: inject ErrorAction as preference variable instead of CLI arg -ErrorAction as a CLI arg only affects the caller, not the script's internal error handling. Setting $ErrorActionPreference inside main.ps1 correctly overrides the default 'Stop' behavior for the user's code. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: ensure full backward compatibility with existing powershell scripts - Only filter common param names when [CmdletBinding()] is present (without it, $Verbose etc. are regular user-defined parameters) - Only add 4>verbose.log 5>debug.log and log output lines when common params are actually enabled — original wrapper is unchanged otherwise Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: lighter styling for common params section Replaced heavy Section component with a subtle inline chevron toggle labeled "Common parameters". Smaller text, secondary color, indented options. Badges still show when collapsed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: rename section to CmdletBinding parameters Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add ..Default::default() to windmill-parser-r (new parser from main) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: missing comma in graphql parser test + merge main Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add missing commas before ..Default::default() in parser tests Merge from main brought test constructors with formatting issues from the original automated script (missing comma between last field and ..Default::default()). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: restore comment markers in nu parser test that script broke Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address PR review — ignore commented CmdletBinding, clear stale params 1. Parser: strip comment lines before detecting [CmdletBinding()] to avoid false positives from commented-out attributes 2. RunForm: always assign psCommonParams (not just when non-empty) so stale settings from a previous run don't leak into later runs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
703 lines
22 KiB
Rust
703 lines
22 KiB
Rust
#[cfg(test)]
|
|
mod test {
|
|
use serde_json::json;
|
|
use windmill_parser::{Arg, MainArgSignature, ObjectType, Typ};
|
|
use windmill_parser_nu::parse_nu_signature;
|
|
|
|
#[test]
|
|
fn test_nu_no_main_sig() {
|
|
assert!(parse_nu_signature("").is_err());
|
|
}
|
|
#[test]
|
|
fn test_nu_any_sig() {
|
|
let sig = parse_nu_signature(
|
|
r#"
|
|
def main [ a, b , c, d] {}
|
|
"#,
|
|
)
|
|
.unwrap();
|
|
assert_eq!(
|
|
MainArgSignature {
|
|
star_args: false,
|
|
star_kwargs: false,
|
|
args: vec![
|
|
Arg {
|
|
name: "a".into(),
|
|
otyp: None,
|
|
typ: Typ::Unknown,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "b".into(),
|
|
otyp: None,
|
|
typ: Typ::Unknown,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "c".into(),
|
|
otyp: None,
|
|
typ: Typ::Unknown,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "d".into(),
|
|
otyp: None,
|
|
typ: Typ::Unknown,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
}
|
|
],
|
|
auto_kind: None,
|
|
has_preprocessor: None,
|
|
..Default::default()
|
|
},
|
|
sig
|
|
);
|
|
}
|
|
#[test]
|
|
fn test_nu_optional_sig() {
|
|
let sig = parse_nu_signature(
|
|
r#"
|
|
def main [foo?] {}
|
|
"#,
|
|
)
|
|
.unwrap();
|
|
|
|
assert_eq!(
|
|
MainArgSignature {
|
|
star_args: false,
|
|
star_kwargs: false,
|
|
args: vec![Arg {
|
|
name: "foo".into(),
|
|
otyp: None,
|
|
typ: Typ::Unknown,
|
|
default: Some(serde_json::Value::Null),
|
|
has_default: true,
|
|
oidx: None
|
|
},],
|
|
auto_kind: None,
|
|
has_preprocessor: None,
|
|
..Default::default()
|
|
},
|
|
sig
|
|
);
|
|
}
|
|
#[test]
|
|
fn test_nu_simple_typed_sig() {
|
|
let sig = parse_nu_signature(
|
|
r#"
|
|
def main [ foo: string, bar: int] {}
|
|
"#,
|
|
)
|
|
.unwrap();
|
|
|
|
assert_eq!(
|
|
MainArgSignature {
|
|
star_args: false,
|
|
star_kwargs: false,
|
|
args: vec![
|
|
Arg {
|
|
name: "foo".into(),
|
|
otyp: None,
|
|
typ: Typ::Str(None),
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "bar".into(),
|
|
otyp: None,
|
|
typ: Typ::Int,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
],
|
|
auto_kind: None,
|
|
has_preprocessor: None,
|
|
..Default::default()
|
|
},
|
|
sig
|
|
);
|
|
}
|
|
#[test]
|
|
fn test_nu_complete_typed_sig() {
|
|
let sig = parse_nu_signature(
|
|
r#"
|
|
def main [
|
|
a1: any,
|
|
a2: bool,
|
|
a3: int,
|
|
a4: float,
|
|
a5: datetime,
|
|
a6: string,
|
|
a7: record,
|
|
a8: list,
|
|
a9: table,
|
|
a10: nothing,
|
|
] {}
|
|
"#,
|
|
)
|
|
.unwrap();
|
|
|
|
assert_eq!(
|
|
MainArgSignature {
|
|
star_args: false,
|
|
star_kwargs: false,
|
|
args: vec![
|
|
Arg {
|
|
name: "a1".into(),
|
|
otyp: None,
|
|
typ: Typ::Unknown,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "a2".into(),
|
|
otyp: None,
|
|
typ: Typ::Bool,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "a3".into(),
|
|
otyp: None,
|
|
typ: Typ::Int,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "a4".into(),
|
|
otyp: None,
|
|
typ: Typ::Float,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "a5".into(),
|
|
otyp: None,
|
|
typ: Typ::Datetime,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "a6".into(),
|
|
otyp: None,
|
|
typ: Typ::Str(None),
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "a7".into(),
|
|
otyp: None,
|
|
typ: Typ::Object(ObjectType::new(None, Some(vec![]))),
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "a8".into(),
|
|
otyp: None,
|
|
typ: Typ::List(Box::new(Typ::Unknown)),
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "a9".into(),
|
|
otyp: None,
|
|
typ: Typ::List(Box::new(Typ::Object(ObjectType::new(None, Some(vec![]))))),
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "a10".into(),
|
|
otyp: None,
|
|
typ: Typ::Unknown,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
],
|
|
auto_kind: None,
|
|
has_preprocessor: None,
|
|
..Default::default()
|
|
},
|
|
sig
|
|
);
|
|
}
|
|
#[test]
|
|
fn test_nu_default_sig() {
|
|
let sig = parse_nu_signature(
|
|
r#"
|
|
def main [ foo = "Foo", bar: string = "Bar", bazz = 3 ] {}
|
|
"#,
|
|
)
|
|
.unwrap();
|
|
|
|
println!("{}", serde_json::to_string_pretty(&sig).unwrap());
|
|
|
|
assert_eq!(
|
|
MainArgSignature {
|
|
star_args: false,
|
|
star_kwargs: false,
|
|
args: vec![
|
|
Arg {
|
|
name: "foo".into(),
|
|
otyp: None,
|
|
typ: Typ::Unknown,
|
|
default: Some(json!("Foo")),
|
|
has_default: true,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "bar".into(),
|
|
otyp: None,
|
|
typ: Typ::Str(None),
|
|
default: Some(json!("Bar")),
|
|
has_default: true,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "bazz".into(),
|
|
otyp: None,
|
|
typ: Typ::Unknown,
|
|
default: Some(json!(3)),
|
|
has_default: true,
|
|
oidx: None
|
|
},
|
|
],
|
|
auto_kind: None,
|
|
has_preprocessor: None,
|
|
..Default::default()
|
|
},
|
|
sig
|
|
);
|
|
}
|
|
#[test]
|
|
fn test_nu_preprocessor_sig() {}
|
|
|
|
#[test]
|
|
fn test_nu_flags_sig() {
|
|
assert!(parse_nu_signature(
|
|
r#"
|
|
def main [--flag] {}
|
|
"#,
|
|
)
|
|
.is_err());
|
|
}
|
|
#[test]
|
|
fn test_nu_rest_sig() {
|
|
assert!(parse_nu_signature(
|
|
r#"
|
|
def main [...foo: string] {}
|
|
"#,
|
|
)
|
|
.is_err())
|
|
}
|
|
|
|
// #[test]
|
|
// fn test_nu_dynamically_sized_sig() {
|
|
// parse_nu_signature(
|
|
// r#"
|
|
// def main [] {
|
|
|
|
// }
|
|
// "#,
|
|
// );
|
|
// }
|
|
// #[test]
|
|
// fn test_nu_record_sig() {
|
|
// let sig = parse_nu_signature(
|
|
// r#"
|
|
// def main [ foo: record<a: string, b, c: number, d> ] { }
|
|
// "#,
|
|
// )
|
|
// .unwrap();
|
|
|
|
// assert_eq!(
|
|
// MainArgSignature {
|
|
// star_args: false,
|
|
// star_kwargs: false,
|
|
// args: vec![Arg {
|
|
// name: "foo".into(),
|
|
// otyp: None,
|
|
// typ: Typ::Object(vec![
|
|
// ObjectProperty { key: "a".into(), typ: Box::new(Typ::Str(None)) },
|
|
// ObjectProperty { key: "b".into(), typ: Box::new(Typ::Unknown) },
|
|
// ObjectProperty { key: "c".into(), typ: Box::new(Typ::Float) },
|
|
// ObjectProperty { key: "d".into(), typ: Box::new(Typ::Unknown) },
|
|
// ]),
|
|
// default: None,
|
|
// has_default: false,
|
|
// oidx: None
|
|
// },],
|
|
// auto_kind: None,
|
|
// has_preprocessor: None,
|
|
// ..Default::default()
|
|
// },
|
|
// sig
|
|
// );
|
|
// }
|
|
|
|
#[test]
|
|
fn test_nu_list_sig() {
|
|
let sig = parse_nu_signature(
|
|
r#"
|
|
def main [ foo: list<number> ] { }
|
|
"#,
|
|
)
|
|
.unwrap();
|
|
|
|
println!("{}", serde_json::to_string_pretty(&sig).unwrap());
|
|
|
|
assert_eq!(
|
|
MainArgSignature {
|
|
star_args: false,
|
|
star_kwargs: false,
|
|
args: vec![Arg {
|
|
name: "foo".into(),
|
|
otyp: None,
|
|
typ: Typ::List(Box::new(Typ::Float)),
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},],
|
|
auto_kind: None,
|
|
has_preprocessor: None,
|
|
..Default::default()
|
|
},
|
|
sig
|
|
);
|
|
}
|
|
#[test]
|
|
fn test_nu_list_full_sig() {
|
|
let sig = parse_nu_signature(
|
|
r#"
|
|
def main [ a, foo: list<number> = [ 2, 3, 4 ], b ] { }
|
|
"#,
|
|
)
|
|
.unwrap();
|
|
|
|
println!("{}", serde_json::to_string_pretty(&sig).unwrap());
|
|
|
|
assert_eq!(
|
|
MainArgSignature {
|
|
star_args: false,
|
|
star_kwargs: false,
|
|
args: vec![
|
|
Arg {
|
|
name: "a".into(),
|
|
otyp: None,
|
|
typ: Typ::Unknown,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "foo".into(),
|
|
otyp: None,
|
|
typ: Typ::List(Box::new(Typ::Float)),
|
|
default: Some(json!([2, 3, 4])),
|
|
has_default: true,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "b".into(),
|
|
otyp: None,
|
|
typ: Typ::Unknown,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
],
|
|
auto_kind: None,
|
|
has_preprocessor: None,
|
|
..Default::default()
|
|
},
|
|
sig
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn test_nu_datetime_sig() {
|
|
let sig = parse_nu_signature(
|
|
r#"
|
|
def main [ foo: datetime ] { }
|
|
"#,
|
|
)
|
|
.unwrap();
|
|
|
|
assert_eq!(
|
|
MainArgSignature {
|
|
star_args: false,
|
|
star_kwargs: false,
|
|
args: vec![Arg {
|
|
name: "foo".into(),
|
|
otyp: None,
|
|
typ: Typ::Datetime,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},],
|
|
auto_kind: None,
|
|
has_preprocessor: None,
|
|
..Default::default()
|
|
},
|
|
sig
|
|
);
|
|
}
|
|
// TODO: Re-enable for V1
|
|
// #[test]
|
|
// fn test_nu_table_sig() {
|
|
// let sig = parse_nu_signature(
|
|
// r#"
|
|
// def main [ foo: table<a, b: number, c: string>] { }
|
|
// "#,
|
|
// )
|
|
// .unwrap();
|
|
|
|
// assert_eq!(
|
|
// MainArgSignature {
|
|
// star_args: false,
|
|
// star_kwargs: false,
|
|
// args: vec![Arg {
|
|
// name: "foo".into(),
|
|
// otyp: None,
|
|
// typ: Typ::List(Box::new(Typ::Object(vec![
|
|
// ObjectProperty { key: "a".into(), typ: Box::new(Typ::Unknown) },
|
|
// ObjectProperty { key: "b".into(), typ: Box::new(Typ::Float) },
|
|
// ObjectProperty { key: "c".into(), typ: Box::new(Typ::Str(None)) },
|
|
// ]))),
|
|
// default: None,
|
|
// has_default: false,
|
|
// oidx: None
|
|
// },],
|
|
// auto_kind: None,
|
|
// has_preprocessor: None,
|
|
// ..Default::default()
|
|
// },
|
|
// sig
|
|
// );
|
|
// }
|
|
|
|
#[test]
|
|
fn test_nu_wrapup_sig() {
|
|
let sig = parse_nu_signature(
|
|
r#"
|
|
def main [a ,b :int,c? , d: string = "foo", bi?: any] {}
|
|
"#,
|
|
)
|
|
.unwrap();
|
|
|
|
assert_eq!(
|
|
MainArgSignature {
|
|
star_args: false,
|
|
star_kwargs: false,
|
|
args: vec![
|
|
Arg {
|
|
name: "a".into(),
|
|
otyp: None,
|
|
typ: Typ::Unknown,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "b".into(),
|
|
otyp: None,
|
|
typ: Typ::Int,
|
|
default: None,
|
|
has_default: false,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "c".into(),
|
|
otyp: None,
|
|
typ: Typ::Unknown,
|
|
default: Some(serde_json::Value::Null),
|
|
has_default: true,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "d".into(),
|
|
otyp: None,
|
|
typ: Typ::Str(None),
|
|
default: Some(json!("foo")),
|
|
has_default: true,
|
|
oidx: None
|
|
},
|
|
Arg {
|
|
name: "bi".into(),
|
|
otyp: None,
|
|
typ: Typ::Unknown,
|
|
default: Some(serde_json::Value::Null),
|
|
has_default: true,
|
|
oidx: None
|
|
}
|
|
],
|
|
auto_kind: None,
|
|
has_preprocessor: None,
|
|
..Default::default()
|
|
},
|
|
sig
|
|
);
|
|
}
|
|
// #[test]
|
|
// fn test_nu_wrapup_nested_sig() {
|
|
// let sig = parse_nu_signature(
|
|
// r#"
|
|
// def main [
|
|
// baz: string,
|
|
// foo: record<a: string,
|
|
// b,
|
|
// c: list<number>,
|
|
// d: record<a1, b1, c1>>
|
|
// =
|
|
// {
|
|
// a: "a",
|
|
// b: 3,
|
|
// c: [ 2, 3, 4 ],
|
|
// d: {
|
|
// a: true,
|
|
// b: false,
|
|
// c: true
|
|
// }
|
|
// }
|
|
// ] { }
|
|
// "#,
|
|
// )
|
|
// .unwrap();
|
|
|
|
// println!("{}", serde_json::to_string_pretty(&sig).unwrap());
|
|
|
|
// assert_eq!(
|
|
// MainArgSignature {
|
|
// star_args: false,
|
|
// star_kwargs: false,
|
|
// args: vec![
|
|
// Arg {
|
|
// name: "baz".into(),
|
|
// otyp: None,
|
|
// typ: Typ::Str(None),
|
|
// default: None,
|
|
// has_default: false,
|
|
// oidx: None
|
|
// },
|
|
// Arg {
|
|
// name: "foo".into(),
|
|
// otyp: None,
|
|
// typ: Typ::Object(vec![
|
|
// ObjectProperty { key: "a".into(), typ: Box::new(Typ::Str(None)) },
|
|
// ObjectProperty { key: "b".into(), typ: Box::new(Typ::Unknown) },
|
|
// ObjectProperty {
|
|
// key: "c".into(),
|
|
// typ: Box::new(Typ::List(Box::new(Typ::Float)))
|
|
// },
|
|
// ObjectProperty {
|
|
// key: "d".into(),
|
|
// typ: Box::new(Typ::Object(vec![
|
|
// ObjectProperty {
|
|
// key: "a1".into(),
|
|
// typ: Box::new(Typ::Unknown)
|
|
// },
|
|
// ObjectProperty {
|
|
// key: "b1".into(),
|
|
// typ: Box::new(Typ::Unknown)
|
|
// },
|
|
// ObjectProperty {
|
|
// key: "c1".into(),
|
|
// typ: Box::new(Typ::Unknown)
|
|
// }
|
|
// ]))
|
|
// },
|
|
// ]),
|
|
// default: Some(json!({
|
|
// "a": "a",
|
|
// "b": 3,
|
|
// "c": [
|
|
// 2,
|
|
// 3,
|
|
// 4
|
|
// ],
|
|
// "d": {
|
|
// "a": true,
|
|
// "b": false,
|
|
// "c": true
|
|
// }
|
|
// })),
|
|
// has_default: true,
|
|
// oidx: None
|
|
// },
|
|
// ],
|
|
// auto_kind: None,
|
|
// has_preprocessor: None,
|
|
// ..Default::default()
|
|
// },
|
|
// sig
|
|
// );
|
|
// }
|
|
#[test]
|
|
fn test_nu_nested_extra_types() {
|
|
assert_eq!(
|
|
parse_nu_signature(
|
|
r#"
|
|
def main [a: list<int>] {}
|
|
"#,
|
|
)
|
|
.is_err(),
|
|
true
|
|
);
|
|
assert_eq!(
|
|
parse_nu_signature(
|
|
r#"
|
|
def main [a: list<float>] {}
|
|
"#,
|
|
)
|
|
.is_err(),
|
|
true
|
|
);
|
|
assert_eq!(
|
|
parse_nu_signature(
|
|
r#"
|
|
def main [a: list<datetime>] {}
|
|
"#,
|
|
)
|
|
.is_err(),
|
|
true
|
|
);
|
|
assert_eq!(
|
|
parse_nu_signature(
|
|
r#"
|
|
def main [a: list<binary>] {}
|
|
"#,
|
|
)
|
|
.is_err(),
|
|
true
|
|
);
|
|
assert_eq!(
|
|
parse_nu_signature(
|
|
r#"
|
|
def main [a: list<list<int>>] {}
|
|
"#,
|
|
)
|
|
.is_err(),
|
|
true
|
|
);
|
|
}
|
|
}
|