mbland / go-script-bash

Framework for writing modular, discoverable, testable Bash scripts
ISC License
95 stars 16 forks source link

Add continuation before breaking conditional statement #177

Closed mtlewis closed 7 years ago

mtlewis commented 7 years ago

Can't figure out how to list coverage locally, so I'm speculatively opening a PR to see if adding a continuation in this if statement fixes issues with coverage detection.

mbland commented 7 years ago

Hey Mike, sorry for the delay...after another PR came in, looks like something funny's going on with kcov on the new Ubuntu Trusty images on Travis. Will try to figure that out and take a look at this soon.

mbland commented 7 years ago

Hey Mike, sorry it's been a while...finally got some time to dig into the failure. When SimonKagstrom/kcov#211 gets merged, I'll kick off a new build and review.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.002%) to 94.627% when pulling dfb34852dd809a2d772d7331fcac130dd834783d on mtlewis:if-continuation into 9319b70bfa923a3eaefca6e9fbdbe92ba575f3a6 on mbland:master.

mbland commented 7 years ago

Hi Mike, SimonKagstrom/kcov#211 got merged and I kicked off a new build. However, this change didn't result in line 25 getting counted as covered:

I've figured out how to demonstrate that the line misses are an artifact of how Bash counts lines internally:

$ cat > foo
#! /usr/bin/env bash

if [[ 'foo' == 'foo' && \
      'bar' == 'bar' ]]; then
  echo 'baz'
fi

$ PS4='${LINENO} ' bash -x foo
4 [[ foo == \f\o\o ]]
4 [[ bar == \b\a\r ]]
5 echo baz
baz

Thanks for giving it a try, though!