Permalink
Browse files

Add a test script and a functional test for the safari-borking bug re…

…ported by rharmes.
  • Loading branch information...
1 parent a3fbd7c commit 04665d549a79f57a9b22d2f640cd9a1d2847ac9f isaacs committed Jul 23, 2009
Showing with 40 additions and 0 deletions.
  1. +6 −0 tests/README
  2. +3 −0 tests/media-test.css
  3. +1 −0 tests/media-test.css.min
  4. +30 −0 tests/suite.sh
View
@@ -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!
View
@@ -0,0 +1,3 @@
+@media screen and (-webkit-min-device-pixel-ratio:0) {
+ some-css : here
+}
View
@@ -0,0 +1 @@
+@media screen and (-webkit-min-device-pixel-ratio:0){some-css:here;}
View
@@ -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.