Skip to content

Conversation

CauhxMilloy
Copy link

  • Updating batslib_count_lines to automatically detect trailing newlines and count them if present.
    • This works on the concept that a string has a trailing newline if it was intended -- e.g. via run --keep-empty-lines or similar.
  • Updating batslib_prefix and batslib_mark to accept --keep-empty-lines option to properly print empty lines and trailing newlines.
  • Updating batslib_print_kv_single_or_multi calls to batslib_prefix.
    • Will automatically detect trailing new lines (on a per-value basis).
    • If trailing newline is present, --keep-empty-lines will be passed to batslib_prefix.

This implements option 4 for batslib_count_lines and batslib_print_kv_single_or_multi, and option 2 for batslib_prefix and batslib_mark, as discussed in #11.

Fixes #11.

* Updating `batslib_count_lines` to automatically detect trailing newlines and count them if present.
  * This works on the concept that a string has a trailing newline if it was intended -- e.g. via `run --keep-empty-lines` or similar.
* Updating `batslib_prefix` and `batslib_mark` to accept `--keep-empty-lines` option to properly print empty lines and trailing newlines.
* Updating `batslib_print_kv_single_or_multi` calls to `batslib_prefix`.
  * Will automatically detect trailing new lines (on a per-value basis).
  * If trailing newline is present, `--keep-empty-lines` will be passed to `batslib_prefix`.

This implements option 4 for `batslib_count_lines` and `batslib_print_kv_single_or_multi`, and option 2 for `batslib_prefix` and `batslib_mark`, as discussed in bats-core#11.

Fixes bats-core#11.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How Should batslib_count_lines Handle Trailing Newlines?
1 participant