Skip to content

Commit

Permalink
test uuid fix #4
Browse files Browse the repository at this point in the history
  • Loading branch information
francescobianco committed Oct 19, 2020
1 parent 252d2bf commit 9e60c54
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 23 deletions.
8 changes: 0 additions & 8 deletions demo.sh

This file was deleted.

17 changes: 5 additions & 12 deletions lcov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ set -ef
VERSION="0.1.0"
LCOV_PS4='+:lcov.sh:${BASH_SOURCE}:${LINENO}:${FUNCNAME[0]}: '

usage () {
usage() {
echo "Usage: ./lcov.sh [OPTION]... FILE..."
echo ""
echo "Executes FILE as a test case also collect each LCOV info and generate HTML report"
Expand Down Expand Up @@ -305,7 +305,7 @@ lcov_test_stat () {
}

##
# Execute testcase and process LCOV info.
# Execute test case and process LCOV info.
##
lcov_test() {
if [[ -n "$1" ]]; then
Expand Down Expand Up @@ -360,6 +360,9 @@ lcov_test_check() {
local exit_code="$2"
if [[ ${exit_code} -eq 0 ]]; then
lcov_append_info "${lcov_test_log}" "${lcov_test_out}"
local info=$(grep . "${lcov_test_out}" | tail -1)
echo -e "${done_flag} ${test}: '${info}' (ok)";
lcov_test_stat 1 1 0 0
else
local info="$(grep "." "${lcov_test_out}" | tail -1)"
[[ -z "${info}" ]] && info="$(grep "." "${lcov_test_log}" | tail -1)"
Expand All @@ -380,11 +383,7 @@ lcov_append_info() {
echo "${line_stop}" >> "$1"
#echo "STOP" >> /home/francesco/Develop/Javanile/lcov.sh/a.txt
#cat "$1" >> /home/francesco/Develop/Javanile/lcov.sh/a.txt
echo "YY"
index=0
while IFS= read -r line || [[ -n "${line}" ]]; do
index=$((index+1))
echo "$index"
if [[ "${line::1}" = "+" ]]; then
scope=$(echo ${line} | cut -s -d':' -f2)
if [[ "${scope}" = "lcov.sh" ]]; then
Expand All @@ -396,14 +395,8 @@ lcov_append_info() {
fi
fi
elif [[ "${line}" = "${line_stop}" ]]; then
if [[ -n "$2" ]]; then
info=$(grep . "$2" | tail -1)
echo -e "${done_flag} $1: '${info}' (ok)";
fi
echo "LL"
lcov_exec -q -a "${temp_info}" -a "${lcov_info}" -o "${lcov_info}"
rm -f "${temp_info}"
lcov_test_stat 1 1 0 0
fi
done < "$1"
}
Expand Down
Empty file added test/fixtures/sample.md
Empty file.
6 changes: 3 additions & 3 deletions test/get_files.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ source ./deps/pipetest/pipetest.sh
# shellcheck source=./lcov.sh
source ./lcov.sh -o test/coverage

get_files ./*.md !./*.sh | assert_equals "$(cat <<EOF
./README.md
get_files ./test/fixtures/*.md !./*.sh | assert_equals "$(cat <<EOF
./test/fixtures/sample.md
EOF
)"

get_files ./test/fixtures/*.sh !deps !lcov.sh !*test.sh | sort | assert_equals "$(cat <<EOF
get_files ./test/fixtures/*.sh !deps !lcov.sh !*test.sh !example* !test/bats* | sort | assert_equals "$(cat <<EOF
./test/fixtures/sample.sh
./test/fixtures/test1.sh
./test/fixtures/test2.sh
Expand Down
23 changes: 23 additions & 0 deletions test/usage.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -e

# shellcheck disable=SC1091
source ./deps/pipetest/pipetest.sh
# shellcheck source=./lcov.sh
source ./lcov.sh -o test/coverage

usage | assert_equals "$(cat <<EOF
Usage: ./lcov.sh [OPTION]... FILE...
Executes FILE as a test case also collect each LCOV info and generate HTML report
List of available options
-e, --extension EXT Coverage of every *.EXT file (default: sh)
-i, --include PATH Include files matching PATH
-x, --exclude PATH Exclude files matching PATH
-o, --output OUTDIR Write HTML output to OUTDIR
-h, --help Display this help and exit
-v, --version Display current version
Documentation can be found at https://github.com/javanile/lcov.sh
EOF
)"

0 comments on commit 9e60c54

Please sign in to comment.