Skip to content

Commit

Permalink
Add a test script and a functional test for the safari-borking bug re…
Browse files Browse the repository at this point in the history
…ported by rharmes.
  • Loading branch information
isaacs committed Jul 23, 2009
1 parent a3fbd7c commit 04665d5
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/README
@@ -0,0 +1,6 @@
To add a test:

1. Create a "blah.css" or "blah.js" file.
2. Create a "blah.css.min" or "blah.js.min" file, containing the expected minified output.

That's all!
3 changes: 3 additions & 0 deletions tests/media-test.css
@@ -0,0 +1,3 @@
@media screen and (-webkit-min-device-pixel-ratio:0) {
some-css : here
}
1 change: 1 addition & 0 deletions tests/media-test.css.min
@@ -0,0 +1 @@
@media screen and (-webkit-min-device-pixel-ratio:0){some-css:here;}
30 changes: 30 additions & 0 deletions tests/suite.sh
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

cd $(dirname $0)

ls *.{css,js} | egrep -v '\.min$' | while read testfile; do

expected="$(
cat $( ls $testfile* | egrep '\.min$' )
)"
actual="$(
java -jar ../build/yuicompressor*.jar $testfile
)"

if [ "$expected" == "$actual" ]; then
echo "Passed: $testfile" > /dev/stderr
else
(
echo "Test failed: $testfile"
echo ""
echo "Expected:"
echo "$expected"
echo ""
echo "Actual:"
echo "$actual"
) > /dev/stderr
exit 1
fi
done

exit 0

0 comments on commit 04665d5

Please sign in to comment.