forked from lovesegfault/beautysh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix indent/outdent error for strings containing brackets (lovesegfault#36) Add --check cmd line option (lovesegfault#35) Enable TravisCI integration for tests More elaborate unit tests Fix travisCI Fix parser problem with escaped quote characters Fix parser problem with escaped quote characters
- Loading branch information
Showing
7 changed files
with
212 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
sudo: false | ||
|
||
language: python | ||
|
||
python: | ||
- 3.5 | ||
|
||
install: | ||
- pip install nose | ||
|
||
script: | ||
- python setup.py test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Shell file taken from Bash v5 source folder (tests/getopts1.sub) | ||
|
||
aflag= | ||
bflag= | ||
|
||
while getopts ab: name | ||
do | ||
case $name in | ||
a) aflag=1 ;; | ||
b) bflag=1 | ||
bval=$OPTARG ;; | ||
?) echo Usage: $0 [-a] [-b value] args | ||
exit 2 ;; | ||
esac | ||
|
||
done | ||
|
||
if [ ! -z "$aflag" ] ; then echo -a specified ; fi | ||
if [ ! -z "$bflag" ] ; then echo -b $bval specified ; fi | ||
|
||
if [ "$OPTIND" -gt 1 ] | ||
then | ||
shift $(( $OPTIND - 1 )) | ||
fi | ||
|
||
echo remaining args: "$*" | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Shell file taken from Bash v5 source folder (tests/getopts1.sub) | ||
|
||
aflag= | ||
bflag= | ||
|
||
while getopts ab: name | ||
do | ||
case $name in | ||
a) aflag=1 ;; | ||
b) bflag=1 | ||
bval=$OPTARG;; | ||
?) echo Usage: $0 [-a] [-b value] args | ||
exit 2;; | ||
esac | ||
|
||
done | ||
|
||
if [ ! -z "$aflag" ] ; then echo -a specified ; fi | ||
if [ ! -z "$bflag" ] ; then echo -b $bval specified ; fi | ||
|
||
if [ "$OPTIND" -gt 1 ] | ||
then | ||
shift $(( $OPTIND - 1 )) | ||
fi | ||
|
||
echo remaining args: "$*" | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
# this small snippet is to test against regressions for issue#29 | ||
# https://github.com/bemeurer/beautysh/issues/29 | ||
|
||
function string_with_brackets_inside1() | ||
{ | ||
local re='^[\-]?[[0-9]+$' | ||
|
||
# following line contains wrong double TAB: | ||
echo "hello world" | ||
} | ||
|
||
function string_with_brackets_inside2() | ||
{ | ||
RESTORE="$(echo -en '\033[0m')" | ||
|
||
# following line contains wrong TAB: | ||
echo "hello world" | ||
} | ||
|
||
function quote_escapes1() | ||
{ | ||
T=$(echo "\"a\"") | ||
echo "command to indent" | ||
} | ||
|
||
function complex_mix1() | ||
{ | ||
while true; do | ||
for i in $(seq 1 100); do | ||
local str_with_brackets="[]]]]" | ||
local str_with_escapes="\"\"\"\"" | ||
|
||
# try a command in a $() expansion | ||
if [ -z "$(echo)" ]; then | ||
quote_escapes1 | ||
string_with_brackets_inside1 | ||
string_with_brackets_inside2 | ||
fi | ||
done | ||
done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
# this small snippet is to test against regressions for issue#29 | ||
# https://github.com/bemeurer/beautysh/issues/29 | ||
|
||
function string_with_brackets_inside1() | ||
{ | ||
local re='^[\-]?[[0-9]+$' | ||
|
||
# following line contains wrong double TAB: | ||
echo "hello world" | ||
} | ||
|
||
function string_with_brackets_inside2() | ||
{ | ||
RESTORE="$(echo -en '\033[0m')" | ||
|
||
# following line contains wrong TAB: | ||
echo "hello world" | ||
} | ||
|
||
function quote_escapes1() | ||
{ | ||
T=$(echo "\"a\"") | ||
echo "command to indent" | ||
} | ||
|
||
function complex_mix1() | ||
{ | ||
while true; do | ||
for i in $(seq 1 100); do | ||
local str_with_brackets="[]]]]" | ||
local str_with_escapes="\"\"\"\"" | ||
|
||
# try a command in a $() expansion | ||
if [ -z "$(echo)" ]; then | ||
quote_escapes1 | ||
string_with_brackets_inside1 | ||
string_with_brackets_inside2 | ||
fi | ||
done | ||
done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters