nushell/crates/nu-command/tests/format_conversions
goldfish ee74ec7423
Make the subcommands (from {csv, tsv, ssv}) 0-based for consistency (#13209)
# Description

fixed #11678

The sub-commands of from command (`from {csv, tsv, ssv}`) name columns
starting from index 0.
This behaviour is inconsistent with other commands such as `detect
columns`.
This PR makes the subcommands index 0-based.

# User-Facing Changes

The subcommands (`from {csv, tsv, ssv}`) return a table with the columns
starting at index 0 if no header data is passed.

```
~/Development/nushell> "foo bar baz" | from ssv -n -m 1 
╭───┬─────────┬─────────┬─────────╮
│ # │ column0 │ column1 │ column2 │
├───┼─────────┼─────────┼─────────┤
│ 0 │ foo     │ bar     │ baz     │
╰───┴─────────┴─────────┴─────────╯
~/Development/nushell> "foo,bar,baz" | from csv -n 
╭───┬─────────┬─────────┬─────────╮
│ # │ column0 │ column1 │ column2 │
├───┼─────────┼─────────┼─────────┤
│ 0 │ foo     │ bar     │ baz     │
╰───┴─────────┴─────────┴─────────╯
~/Development/nushell> "foo\tbar\tbaz" | from tsv -n
╭───┬─────────┬─────────┬─────────╮
│ # │ column0 │ column1 │ column2 │
├───┼─────────┼─────────┼─────────┤
│ 0 │ foo     │ bar     │ baz     │
╰───┴─────────┴─────────┴─────────╯
```


# Tests + Formatting

When I ran tests, `commands::touch::change_file_mtime_to_reference`
failed with the following error.
The error also occurs in the master branch, so it's probably unrelated
to these changes.
(maybe a problem with my dev environment)

```
$ toolkit check pr

~~~~~~~~

failures:

---- commands::touch::change_file_mtime_to_reference stdout ----
=== stderr

thread 'commands::touch::change_file_mtime_to_reference' panicked at crates/nu-command/tests/commands/touch.rs:298:9:
assertion `left == right` failed
  left: SystemTime { tv_sec: 1719149697, tv_nsec: 57576929 }
 right: SystemTime { tv_sec: 1719149697, tv_nsec: 78219489 }


failures:
    commands::touch::change_file_mtime_to_reference

test result: FAILED. 1533 passed; 1 failed; 32 ignored; 0 measured; 0 filtered out; finished in 10.87s

error: test failed, to rerun pass `-p nu-command --test main`
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🔴 `toolkit test`
-  `toolkit test stdlib`
```

# After Submitting

nothing
2024-06-26 17:51:47 -05:00
..
csv.rs Make the subcommands (from {csv, tsv, ssv}) 0-based for consistency (#13209) 2024-06-26 17:51:47 -05:00
html.rs Remove feat extra and include in default (#12140) 2024-03-10 17:29:02 +01:00
json.rs Make from json --objects streaming (#12949) 2024-05-24 23:37:50 +00:00
markdown.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
mod.rs Msgpack commands (#12664) 2024-04-26 06:23:16 -05:00
msgpack.rs Msgpack commands (#12664) 2024-04-26 06:23:16 -05:00
msgpackz.rs Msgpack commands (#12664) 2024-04-26 06:23:16 -05:00
nuon.rs Deprecate register and add plugin use (#12607) 2024-04-23 06:37:50 -05:00
ods.rs Add long options for formats (#10645) 2023-10-08 19:07:09 +02:00
ssv.rs Make the subcommands (from {csv, tsv, ssv}) 0-based for consistency (#13209) 2024-06-26 17:51:47 -05:00
toml.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00
tsv.rs Make the subcommands (from {csv, tsv, ssv}) 0-based for consistency (#13209) 2024-06-26 17:51:47 -05:00
url.rs Rename to url command to url build-query (#7702) 2023-01-15 10:16:29 -08:00
xlsx.rs Add date support in from xlsx (#11952) 2024-02-24 07:25:51 -06:00
xml.rs Add self-closed tag support for to xml (#11577) 2024-01-19 05:35:29 -06:00
yaml.rs Clean up tests containing unnecessary cwd: tokens (#9692) 2023-07-17 18:43:51 +02:00