about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-01-31 09:10:12 +0000
committerEric Wong <normalperson@yhbt.net>2011-01-31 09:10:12 +0000
commitc122d7cc3e342d17014d8571634e55477286d928 (patch)
tree42cf89f6925395e57024d9be42a99ffcb09db4cd
parentea0455e966a95f7a4be0c8f4b9c0481f0392ff39 (diff)
downloadmahoro-c122d7cc3e342d17014d8571634e55477286d928.tar.gz
test: workaround for mime output variation
libmagic seems to vary between different OSes, and we're
not the only ones with this problem

ref:
http://search.cpan.org/~fitzner/File-LibMagic-0.96/LibMagic.pm#BUGS
-rwxr-xr-xtest.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/test.rb b/test.rb
index 6415afc..049438b 100755
--- a/test.rb
+++ b/test.rb
@@ -17,7 +17,10 @@ class MahoroTestCase < Test::Unit::TestCase
 
         def test_mime_file
                 @m.flags = Mahoro::MIME
-                assert_equal('text/x-c; charset=us-ascii', @m.file('mahoro.c'))
+                assert({
+                  'text/x-c; charset=us-ascii' => true,
+                  'text/x-c charset=us-ascii' => true
+                }.include?(@m.file('mahoro.c')))
         end
 
         def test_buffer
@@ -28,8 +31,10 @@ class MahoroTestCase < Test::Unit::TestCase
 
         def test_mime_buffer
                 @m.flags = Mahoro::MIME
-                assert_equal('text/x-c; charset=us-ascii',
-                             @m.buffer(File.read('mahoro.c')))
+                assert({
+                  'text/x-c; charset=us-ascii' => true,
+                  'text/x-c charset=us-ascii' => true
+                }.include?(@m.buffer(File.read('mahoro.c'))))
         end
 
         def test_valid