Commit e58fad96 authored by User expired's avatar User expired
Browse files

test: More detailed tests for formatting

parent cfa67c7c
......@@ -95,7 +95,7 @@ do
# Indent with two spaces.
sed -i -r 's/^[ \t]*([A-Za-z][^={"]*[^ ={"])[ \t]*=[ \t]*/ \1 = /' "$tmpfile"
# Title case keys.
# Title case entry types.
sed -i -r 's/^@([A-Za-z]+)\{/@\L\u\1{/' "$tmpfile"
sed -i -r 's/^ ([A-Za-z]+) = / \L\u\1 = /' "$tmpfile"
......
......@@ -132,6 +132,40 @@ testWhiteSpace() {
assertEquals ' Field = {one two three},' "$(cat $fileOne)"
}
testTitleCaseTypeAndFields() {
echo '@article{any2010:cde' > $fileOne
bib-format $fileOne
assertEquals '@Article{any2010:cde' "$(cat $fileOne)"
echo 'field = {}' > $fileOne
bib-format $fileOne
assertEquals ' Field = {}' "$(cat $fileOne)"
}
testQuotesToCurlyBrackets() {
echo ' Field = "some text"' > $fileOne
bib-format $fileOne
assertEquals ' Field = {some text}' "$(cat $fileOne)"
echo ' Field = "some "more" text"' > $fileOne
bib-format $fileOne
assertEquals ' Field = {some "more" text}' "$(cat $fileOne)"
}
testCurlyBracketsInField() {
echo ' Field = "some {More} text"' > $fileOne
bib-format $fileOne
assertEquals ' Field = {some {More} text}' "$(cat $fileOne)"
echo ' Field = {some {More} text}' > $fileOne
bib-format $fileOne
assertEquals ' Field = {some {More} text}' "$(cat $fileOne)"
}
testMergLines() {
echo ' Field = {some
text}' > $fileOne
bib-format $fileOne
assertEquals ' Field = {some text}' "$(cat $fileOne)"
}
testFormatStructure() {
bib-format -u $fileOne
bib-format -u $fileTwo
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment