mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 23:27:45 +00:00
Deprecate the nu_scripts
version of stdlib-candidate
(#1042)
Deprecates the existing `stdlib-candidate` directories in `nu_scripts` since `std-rfc` has now transitioned to the main repo. Updates readme and renamed directories.
This commit is contained in:
parent
a31f8490fb
commit
5869e0b529
53 changed files with 18 additions and 40 deletions
|
@ -0,0 +1,37 @@
|
|||
use std assert
|
||||
use ../std-rfc parse-arg
|
||||
|
||||
const SPAN = { start: 0, end: 0 }
|
||||
|
||||
export def "test parse-arg ok" [] {
|
||||
const TEST_CASES = [
|
||||
[ input, type, expected ];
|
||||
|
||||
[ "123", "int", 123 ],
|
||||
[ "[1, 2, 3]", "list<int>", [1, 2, 3] ],
|
||||
[ "'spam'", "string", "spam" ],
|
||||
[
|
||||
"{ a: 1, b: 'egg', c: false }",
|
||||
"record<a: int, b: string, c: bool>",
|
||||
{ a: 1, b: 'egg', c: false },
|
||||
],
|
||||
]
|
||||
|
||||
for t in $TEST_CASES {
|
||||
assert equal ($t.input | parse-arg $SPAN $t.type) $t.expected
|
||||
}
|
||||
}
|
||||
|
||||
export def "test parse-arg err" [] {
|
||||
const TEST_CASES = [
|
||||
[ input, type ];
|
||||
|
||||
[ "{ invalid NUON", "" ],
|
||||
[ "[1, 2, 3]", "string" ],
|
||||
]
|
||||
|
||||
for t in $TEST_CASES {
|
||||
let msg = $"test case: input: '($t.input)', type: ($t.type)"
|
||||
assert error { $t.input | parse-arg $SPAN $t.type } $msg
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue