Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Print Functions Consistent with --keep-empty-lines #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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