Skip to content

Instantly share code, notes, and snippets.

@mmalecki
Created November 9, 2012 01:18
Show Gist options
  • Save mmalecki/4043108 to your computer and use it in GitHub Desktop.
Save mmalecki/4043108 to your computer and use it in GitHub Desktop.

Revisions

  1. mmalecki revised this gist Nov 9, 2012. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions test.sh
    Original file line number Diff line number Diff line change
    @@ -32,4 +32,5 @@ if [ $failed -eq 0 ]; then
    else
    echo "$(tput setaf 1)✗ Failed » $failed failed$(tput sgr0)"
    echo "$(tput setaf 2) $passed passed$(tput sgr0)"
    exit 1
    fi
  2. mmalecki revised this gist Nov 9, 2012. 1 changed file with 21 additions and 4 deletions.
    25 changes: 21 additions & 4 deletions test.sh
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,35 @@
    #!/bin/sh
    echo "Running test suite"

    passed=0
    failed=0
    total=0

    for t in test/*-test.js; do
    total=`expr $total + 1`

    echo

    echo "Running $t..."
    output=`node $t`
    code=$?
    if [ $code -ne 0 ]; then
    echo " $(tput setaf 1)$t failed (exit code: $code)$(tput sgr0)"
    echo "Output:"
    failed=`expr $failed + 1`

    echo $output
    exit 1
    echo " $(tput setaf 1)$t (exit code: $code)$(tput sgr0)"
    else
    echo " $(tput setaf 2)$t OK$(tput sgr0)"
    passed=`expr $passed + 1`

    echo " $(tput setaf 2)$t $(tput sgr0)"
    fi
    done

    echo

    if [ $failed -eq 0 ]; then
    echo "$(tput setaf 2)✓ OK » $passed passed$(tput sgr0)"
    else
    echo "$(tput setaf 1)✗ Failed » $failed failed$(tput sgr0)"
    echo "$(tput setaf 2) $passed passed$(tput sgr0)"
    fi
  3. mmalecki created this gist Nov 9, 2012.
    18 changes: 18 additions & 0 deletions test.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #!/bin/sh
    echo "Running test suite"

    for t in test/*-test.js; do
    echo

    echo "Running $t..."
    output=`node $t`
    code=$?
    if [ $code -ne 0 ]; then
    echo " $(tput setaf 1)$t failed (exit code: $code)$(tput sgr0)"
    echo "Output:"
    echo $output
    exit 1
    else
    echo " $(tput setaf 2)$t OK$(tput sgr0)"
    fi
    done