miller/test
Mr. Lance E Sloan e2338195ba
filename options for split (iss. #1365) (#1366)
* #1365 - filename options for `split`

* Don't use joiner string when prefix is empty.
* Add option to specify joiner string.
* Add option to not URL-escape file names.

* #1365 - update documentation

* #1365 - don't URL-escape file name prefix

I **_thought_** it'd be cool to apply URL-escaping to the file name prefix as well, just in case it included spaces or other characters.  I forgot that a common use for the prefix is to specify a directory path that will contain the file.  When the slashes ("`/`") of the path are URL-escaped, they become "`%2F`" and the directories will not be created.  So, I moved the prefix handling code to come after the URL-escaping.

* #1365 - new `split` options for CLI help output

* #1365 - fix escape/suffix logic error

Trying to make the `return` statement cleaner, I thought it'd be good to add the file name suffix immediately after the file name is URL-escaped.  I'd forgotten that the suffix will not be added if the new `-e` option is used to skip URL-escaping.  So, I put the suffix back where I had it.

* #1365 - add `split` to the "10 minutes" document

Not strictly part of this issue, but as I was checking for docs that I should update as a result of my changes, I noticed this document showed how to split data using the `put` and `tee` combination, but not about the `split` verb.

* #1365 - updated manpage

When I ran `make dev`, generating `data-diving-examples.md` failed.  The two `manpage.txt` files ended up empty, but `mlr.1` seems to be correct.

---------

Co-authored-by: Mr. Lance E Sloan (sloanlance) <sloanlance@users.noreply.github.com>
2023-08-23 16:08:48 -04:00
..
cases filename options for split (iss. #1365) (#1366) 2023-08-23 16:08:48 -04:00
cases-not-suitable-for-ci Avoid assuming ./mlr is the mlr to test (#876) 2022-01-17 17:01:40 -05:00
expected Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
input Can't use ${field_name} if it contains UTF-8 characters also encodeable as Latin-1 (#1363) 2023-08-20 12:20:15 -04:00
stdlib Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
README.md Reorganization of new-in-miller-6 docpage (#750) 2021-11-13 23:18:35 -05:00

Miller regression tests

There are a few files unit-tested with Go's testing package -- a few dozen cases total.

The vast majority of Miller tests, though -- thousands of cases -- are tested by running scripted invocations of mlr with various flags and inputs, comparing against expected output, and checking the exit code back to the shell.

How to run the regression tests, in brief

Note: while this README.md file is within the test/ subdirectory, all paths in this file are written from the perspective of the user being cd'ed into the repository base directory, i.e. this directory's parent directory.

  • mlr regtest --help

  • go test -- TODO -- also comment

Items for the duration of the Go port

  • mlr regtest -c ... runs the C version of Miller from the local checkout

More details

TODO: needs to be written up

alias mr='mlr regtest'
mr
mr test/cases/foo
mr -v test/cases/foo
mr -cj test/cases/foo/0003
mr -gj test/cases/foo/0003
mr -gp test/cases/foo/0003
...
mr -gp test/cases/foo
git diff
git reset --hard

Creating new cases

TODO: needs to be written up