2022-02-28 13:10:02 +01:00
|
|
|
use nu_test_support::{nu, pipeline};
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn to_nuon_correct_compaction() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
|
|
|
open appveyor.yml
|
|
|
|
| to nuon
|
|
|
|
| str length
|
|
|
|
| $in > 500
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "true");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn to_nuon_list_of_numbers() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-02-28 13:10:02 +01:00
|
|
|
r#"
|
|
|
|
[1, 2, 3, 4]
|
|
|
|
| to nuon
|
|
|
|
| from nuon
|
|
|
|
| $in == [1, 2, 3, 4]
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "true");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn to_nuon_list_of_strings() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-02-28 13:10:02 +01:00
|
|
|
r#"
|
|
|
|
[abc, xyz, def]
|
|
|
|
| to nuon
|
|
|
|
| from nuon
|
|
|
|
| $in == [abc, xyz, def]
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "true");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn to_nuon_table() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-02-28 13:10:02 +01:00
|
|
|
r#"
|
|
|
|
[[my, columns]; [abc, xyz], [def, ijk]]
|
|
|
|
| to nuon
|
|
|
|
| from nuon
|
|
|
|
| $in == [[my, columns]; [abc, xyz], [def, ijk]]
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "true");
|
|
|
|
}
|
|
|
|
|
2023-11-01 21:25:35 +01:00
|
|
|
#[test]
|
|
|
|
fn from_nuon_illegal_table() {
|
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
|
|
|
"[[repeated repeated]; [abc, xyz], [def, ijk]]"
|
|
|
|
| from nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert!(actual.err.contains("column_defined_twice"));
|
|
|
|
}
|
|
|
|
|
2022-02-28 13:10:02 +01:00
|
|
|
#[test]
|
|
|
|
fn to_nuon_bool() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-02-28 13:10:02 +01:00
|
|
|
r#"
|
2022-03-03 01:55:03 +01:00
|
|
|
false
|
2022-02-28 13:10:02 +01:00
|
|
|
| to nuon
|
|
|
|
| from nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "false");
|
|
|
|
}
|
|
|
|
|
2022-03-25 20:35:37 +01:00
|
|
|
#[test]
|
|
|
|
fn to_nuon_escaping() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-03-25 20:35:37 +01:00
|
|
|
r#"
|
|
|
|
"hello\"world"
|
|
|
|
| to nuon
|
|
|
|
| from nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "hello\"world");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn to_nuon_escaping2() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-03-25 20:35:37 +01:00
|
|
|
r#"
|
|
|
|
"hello\\world"
|
|
|
|
| to nuon
|
|
|
|
| from nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "hello\\world");
|
|
|
|
}
|
|
|
|
|
2022-10-04 13:25:21 +02:00
|
|
|
#[test]
|
|
|
|
fn to_nuon_escaping3() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-10-04 13:25:21 +02:00
|
|
|
r#"
|
|
|
|
["hello\\world"]
|
|
|
|
| to nuon
|
|
|
|
| from nuon
|
|
|
|
| $in == [hello\world]
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "true");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn to_nuon_escaping4() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-10-04 13:25:21 +02:00
|
|
|
r#"
|
|
|
|
["hello\"world"]
|
|
|
|
| to nuon
|
|
|
|
| from nuon
|
|
|
|
| $in == ["hello\"world"]
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "true");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn to_nuon_escaping5() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-10-04 13:25:21 +02:00
|
|
|
r#"
|
|
|
|
{s: "hello\"world"}
|
|
|
|
| to nuon
|
|
|
|
| from nuon
|
|
|
|
| $in == {s: "hello\"world"}
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "true");
|
|
|
|
}
|
|
|
|
|
2022-02-28 13:10:02 +01:00
|
|
|
#[test]
|
|
|
|
fn to_nuon_negative_int() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-02-28 13:10:02 +01:00
|
|
|
r#"
|
|
|
|
-1
|
|
|
|
| to nuon
|
|
|
|
| from nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "-1");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn to_nuon_records() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-02-28 13:10:02 +01:00
|
|
|
r#"
|
|
|
|
{name: "foo bar", age: 100, height: 10}
|
|
|
|
| to nuon
|
|
|
|
| from nuon
|
|
|
|
| $in == {name: "foo bar", age: 100, height: 10}
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "true");
|
|
|
|
}
|
2022-03-01 00:31:53 +01:00
|
|
|
|
2023-02-25 18:29:30 +01:00
|
|
|
#[test]
|
|
|
|
fn to_nuon_range() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2023-02-25 18:29:30 +01:00
|
|
|
r#"
|
|
|
|
1..42
|
|
|
|
| to nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "1..42");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn from_nuon_range() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2023-02-25 18:29:30 +01:00
|
|
|
r#"
|
|
|
|
"1..42"
|
|
|
|
| from nuon
|
|
|
|
| describe
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "range");
|
|
|
|
}
|
|
|
|
|
2023-02-25 19:26:34 +01:00
|
|
|
#[test]
|
|
|
|
fn to_nuon_filesize() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2023-02-25 19:26:34 +01:00
|
|
|
r#"
|
|
|
|
1kib
|
|
|
|
| to nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "1024b");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn from_nuon_filesize() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2023-02-25 19:26:34 +01:00
|
|
|
r#"
|
|
|
|
"1024b"
|
|
|
|
| from nuon
|
|
|
|
| describe
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "filesize");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn to_nuon_duration() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2023-02-25 19:26:34 +01:00
|
|
|
r#"
|
|
|
|
1min
|
|
|
|
| to nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "60000000000ns");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn from_nuon_duration() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2023-02-25 19:26:34 +01:00
|
|
|
r#"
|
|
|
|
"60000000000ns"
|
|
|
|
| from nuon
|
|
|
|
| describe
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "duration");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn to_nuon_datetime() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2023-02-25 19:26:34 +01:00
|
|
|
r#"
|
|
|
|
2019-05-10
|
|
|
|
| to nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "2019-05-10T00:00:00+00:00");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn from_nuon_datetime() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2023-02-25 19:26:34 +01:00
|
|
|
r#"
|
|
|
|
"2019-05-10T00:00:00+00:00"
|
|
|
|
| from nuon
|
|
|
|
| describe
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "date");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn to_nuon_errs_on_closure() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2023-02-25 19:26:34 +01:00
|
|
|
r#"
|
|
|
|
{|| to nuon}
|
|
|
|
| to nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
FEATURE: add `--raw`. `--tabs` and `--indent` to `to nuon` as in `to json` (#8366)
Should close #7255.
# Description
**TL;DR**: this PR adds `--indent <int>`, `--tabs <int>` and `--raw` to
control a bit more the `string` output of `to nuon`, as done in `to
json` already, the goal being to promote the `NUON` format through easy
to read and formatted output `.nuon` files :yum:
### outside of `crates/nu-command/src/formats/to/nuon.rs`
as the signature of `value_to_string` has changed, the single call to it
outside of its module definition has been changed to use default values
=> `value_to_string(&value, Span::unknown(), 0, &None)` in
`crates/nu-command/src/filters/uniq.rs`
### changes to `ToNuon` in `crates/nu-command/src/formats/to/nuon.rs`
- the signature now features `--raw`, `--indent <int>` and `--tabs
<int>`
- the structure of the `run` method is inspired from the one in `to
json`
- we get the values of the arguments
- we convert the input to a usable `Value`
- depending on whether the user raised `--raw`, `--indent` or `--tabs`,
we call the conversion to `string` with different values of the
indentation, starting at depth 0
- finally, we return `Ok` or a `ShellError::CantConvert` depending on
the conversion result
- some tool functions
- `get_true_indentation` gives the full indentation => `indent` repeated
`depth` times
- `get_true_separators` gives the line and field separators => a `("\n",
"")` when using some formatting or `("", " ")` when converting as pure
string on a single line
the meat of `nuon.rs` is now the `value_to_string` recursive function:
- takes the depth and the indent string
- adds correct newlines, space separators and indentation to the output
- calls itself with the same indent string but `depth + 1` to increase
the indentation by one level
- i used the `nl`, `idt`, `idt_po` (**i**n**d**en**t** **p**lus **o**ne)
and `idt_pt` (**i**n**d**en**t** **p**lus **t**wo) to make the
`format!`s easier to read
# User-Facing Changes
users can now
- control the amount and nature of NUON string output indentation with
- `--indent <number of " " per level>`
- `--tabs <number of "\t" per level>`
- use the previous behaviour of `to nuon` with the `--raw` option
- have new examples with `help to nuon`
> **Note**
> the priority order of the options is the following
> 1. `--raw`
> 2. `--tabs`
> 3. `--indent`
>
> the default is `--indent 2`
# Tests + Formatting
### new tests
- tests involving the string output of `to nuon`, i.e. tests not of the
form `... | to nuon | from nuon ...`, now use the `to nuon --raw`
command => this is the smallest change to have the tests pass, as the
new `to nuon --raw` is equivalent to the old `to nuon`
- in `crates/nu-command/src/formats/to/nuon.rs`, the previous example
has been replaced with three examples
- `[1 2 3] | to nuon` to show the default behaviour
- `[1 2 3] | to nuon --raw` to show the not-formatted output
- a more complex example with `{date: 2000-01-01, data: [1 [2 3] 4.56]}
| to nuon`
- the result values have been defined and the `examples` tests pass
### dev
- :green_circle: `cargo fmt --all`
- :green_circle: `cargo clippy --workspace -- -D warnings -D
clippy::unwrap_used -A clippy::needless_collect`
- :green_circle: `cargo test --workspace` ~~passes but without
`to_nuon_errs_on_closure`~~ fixed in
0b4fad7effd5a3adf0ccf2aa694d7a77653f1b55
# After Submitting
the `to nuon` page would have to be regenerated at some point due to the
new tests
2023-03-20 21:47:18 +01:00
|
|
|
assert!(actual.err.contains("can't convert closure to NUON"));
|
2023-02-25 19:26:34 +01:00
|
|
|
}
|
|
|
|
|
2022-03-01 00:31:53 +01:00
|
|
|
#[test]
|
|
|
|
fn binary_to() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-03-01 00:31:53 +01:00
|
|
|
r#"
|
|
|
|
0x[ab cd ef] | to nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "0x[ABCDEF]");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn binary_roundtrip() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-03-01 00:31:53 +01:00
|
|
|
r#"
|
|
|
|
"0x[1f ff]" | from nuon | to nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "0x[1FFF]");
|
|
|
|
}
|
2022-03-07 14:39:02 +01:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn read_binary_data() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
|
|
|
open sample.nuon | get 5.3
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "31")
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn read_record() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
|
|
|
open sample.nuon | get 4.name
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "Bobby")
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn read_bool() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"
|
2022-03-19 20:12:10 +01:00
|
|
|
open sample.nuon | get 3 | $in == true
|
2022-03-07 14:39:02 +01:00
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "true")
|
|
|
|
}
|
2022-06-13 19:45:07 +02:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn float_doesnt_become_int() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-06-13 19:45:07 +02:00
|
|
|
r#"
|
|
|
|
1.0 | to nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "1.0")
|
|
|
|
}
|
2022-06-17 20:01:37 +02:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn float_inf_parsed_properly() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-06-17 20:01:37 +02:00
|
|
|
r#"
|
|
|
|
inf | to nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "inf")
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn float_neg_inf_parsed_properly() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-06-17 20:01:37 +02:00
|
|
|
r#"
|
|
|
|
-inf | to nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "-inf")
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn float_nan_parsed_properly() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-06-17 20:01:37 +02:00
|
|
|
r#"
|
|
|
|
NaN | to nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "NaN")
|
|
|
|
}
|
2022-08-21 12:12:13 +02:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn to_nuon_converts_columns_with_spaces() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
2022-08-21 12:12:13 +02:00
|
|
|
let test = [[a, b, "c d"]; [1 2 3] [4 5 6]]; $test | to nuon | from nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
assert!(actual.err.is_empty());
|
|
|
|
}
|
2022-08-23 13:51:07 +02:00
|
|
|
|
2022-12-30 09:49:35 +01:00
|
|
|
#[test]
|
|
|
|
fn to_nuon_quotes_empty_string() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
2022-12-30 09:49:35 +01:00
|
|
|
let test = ""; $test | to nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
assert!(actual.err.is_empty());
|
|
|
|
assert_eq!(actual.out, r#""""#)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn to_nuon_quotes_empty_string_in_list() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
2022-12-30 09:49:35 +01:00
|
|
|
let test = [""]; $test | to nuon | from nuon | $in == [""]
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
assert!(actual.err.is_empty());
|
|
|
|
assert_eq!(actual.out, "true")
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn to_nuon_quotes_empty_string_in_table() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
2022-12-30 09:49:35 +01:00
|
|
|
let test = [[a, b]; ['', la] [le lu]]; $test | to nuon | from nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
assert!(actual.err.is_empty());
|
|
|
|
}
|
|
|
|
|
2022-08-23 13:51:07 +02:00
|
|
|
#[test]
|
2022-11-19 12:09:39 +01:00
|
|
|
fn does_not_quote_strings_unnecessarily() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
2022-08-23 13:51:07 +02:00
|
|
|
let test = [["a", "b", "c d"]; [1 2 3] [4 5 6]]; $test | to nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
assert_eq!(actual.out, "[[a, b, \"c d\"]; [1, 2, 3], [4, 5, 6]]");
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
2022-08-23 13:51:07 +02:00
|
|
|
let a = {"ro name": "sam" rank: 10}; $a | to nuon
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
assert_eq!(actual.out, "{\"ro name\": sam, rank: 10}");
|
|
|
|
}
|
2022-09-01 14:08:19 +02:00
|
|
|
|
2022-11-19 12:09:39 +01:00
|
|
|
#[test]
|
|
|
|
fn quotes_some_strings_necessarily() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
2022-11-19 12:09:39 +01:00
|
|
|
r#"
|
|
|
|
['true','false','null',
|
|
|
|
'NaN','NAN','nan','+nan','-nan',
|
|
|
|
'inf','+inf','-inf','INF',
|
|
|
|
'Infinity','+Infinity','-Infinity','INFINITY',
|
|
|
|
'+19.99','-19.99', '19.99b',
|
|
|
|
'19.99kb','19.99mb','19.99gb','19.99tb','19.99pb','19.99eb','19.99zb',
|
|
|
|
'19.99kib','19.99mib','19.99gib','19.99tib','19.99pib','19.99eib','19.99zib',
|
|
|
|
'19ns', '19us', '19ms', '19sec', '19min', '19hr', '19day', '19wk',
|
|
|
|
'-11.0..-15.0', '11.0..-15.0', '-11.0..15.0',
|
|
|
|
'-11.0..<-15.0', '11.0..<-15.0', '-11.0..<15.0',
|
|
|
|
'-11.0..', '11.0..', '..15.0', '..-15.0', '..<15.0', '..<-15.0',
|
2022-12-22 00:36:07 +01:00
|
|
|
'2000-01-01', '2022-02-02T14:30:00', '2022-02-02T14:30:00+05:00',
|
2022-12-30 09:49:35 +01:00
|
|
|
',',''
|
2022-12-22 00:36:07 +01:00
|
|
|
'&&'
|
2022-11-19 12:09:39 +01:00
|
|
|
] | to nuon | from nuon | describe
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "list<string>");
|
|
|
|
}
|
|
|
|
|
2022-12-22 01:42:23 +01:00
|
|
|
#[test]
|
|
|
|
fn read_code_should_fail_rather_than_panic() {
|
|
|
|
let actual = nu!(cwd: "tests/fixtures/formats", pipeline(
|
|
|
|
r#"open code.nu | from nuon"#
|
|
|
|
));
|
2024-04-23 13:37:50 +02:00
|
|
|
assert!(actual.err.contains("Error when loading"))
|
2022-12-22 01:42:23 +01:00
|
|
|
}
|