Fix tests and MIME attachments
This commit is contained in:
parent
e279f66801
commit
87c286d5b1
2 changed files with 27 additions and 27 deletions
6
notes.sh
6
notes.sh
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Distributed under the terms of the BSD License
|
||||
#
|
||||
|
@ -121,7 +121,7 @@ get_headers() {
|
|||
FILTER="\
|
||||
{ \
|
||||
if (\$0~/^$/) {exit} \
|
||||
if (\$0!~/^[^ ]*: .*$/) {exit} \
|
||||
if (\$0!~/^[^ ]*:.*$/) {exit} \
|
||||
print \$0 \
|
||||
} \
|
||||
"
|
||||
|
@ -276,7 +276,7 @@ pack_part() {
|
|||
echo "Content-Type: $CONTENT_TYPE"
|
||||
echo "Content-Transfer-Encoding: base64"
|
||||
echo
|
||||
base64 | fold -w 76 < "$PART_FILE"
|
||||
base64 < "$PART_FILE" | fold -w 76
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
16
test.sh
16
test.sh
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Distributed under the terms of the BSD License
|
||||
#
|
||||
|
@ -63,8 +63,8 @@ assert() {
|
|||
result="$(eval 2>/dev/null $1 <<< ${3:-})" || true
|
||||
|
||||
if [[ "$result" == "$expected" ]]; then
|
||||
return
|
||||
fi
|
||||
return
|
||||
fi
|
||||
result="$(sed -e :a -e '$!N;s/\n/\\n/;ta' <<< "$result")"
|
||||
|
||||
echo "Expected '$command' == '$expected'. Got: '$result'"
|
||||
|
@ -169,7 +169,7 @@ edit_note() {
|
|||
NOTE_ID="$(cat "$(pwd)/notes/cur"/* | grep X-Note-Id | cut -d ' ' -f 2)"
|
||||
|
||||
cat > "$(pwd)/editor.sh" <<- EOF
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
FILENAME="\$1"
|
||||
echo "line2" >> "\$FILENAME"
|
||||
EOF
|
||||
|
@ -192,7 +192,7 @@ edit_note_add_file() {
|
|||
NOTE_ID="$(cat "$(pwd)/notes/cur"/* | grep X-Note-Id | cut -d ' ' -f 2)"
|
||||
|
||||
cat > "$(pwd)/editor.sh" <<- EOF
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
FILENAME="\$1"
|
||||
echo "newfile" > "\$FILENAME.txt"
|
||||
EOF
|
||||
|
@ -216,7 +216,7 @@ edit_note_no_modifications() {
|
|||
NOTE_FILE="$(ls "$(pwd)/notes/cur"/*)"
|
||||
|
||||
cat > "$(pwd)/editor.sh" <<- EOF
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
EOF
|
||||
chmod a+x "$(pwd)/editor.sh"
|
||||
export EDITOR="$(pwd)/editor.sh"
|
||||
|
@ -233,7 +233,7 @@ resume_editing() {
|
|||
NOTE_ID="$(cat "$(pwd)/notes/cur"/* | grep X-Note-Id | cut -d ' ' -f 2)"
|
||||
|
||||
cat > "$(pwd)/editor.sh" <<- EOF
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
FILENAME="\$1"
|
||||
echo "myline2" >> "\$FILENAME"
|
||||
exit 1
|
||||
|
@ -247,7 +247,7 @@ resume_editing() {
|
|||
assert 'echo "$OUTPUT" | grep myline | wc -l | tr -d " "' "1"
|
||||
|
||||
cat > "$(pwd)/editor.sh" <<- EOF
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
FILENAME="\$1"
|
||||
echo "myline3" >> "\$FILENAME"
|
||||
EOF
|
||||
|
|
Loading…
Reference in a new issue