about summary refs log tree commit homepage
path: root/test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test.rb')
-rwxr-xr-xtest.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test.rb b/test.rb
index 52b3b80..574979d 100755
--- a/test.rb
+++ b/test.rb
@@ -55,6 +55,25 @@ class MahoroTestCase < Test::Unit::TestCase
                 assert(@m.valid?, 'Default database was not valid.')
         end
 
+        def test_valid_with_null
+                assert_raises(ArgumentError) { @m.valid? "mahoro.c\0" }
+        end
+
+        def test_compile
+                File.open(__FILE__) do |fp|
+                        fp.flock File::LOCK_EX
+                        assert Mahoro.compile("magic.sample")
+                        assert_nothing_raised do
+                                File.unlink("magic.sample.mgc")
+                        end
+                end
+        end
+
+        def test_compile_bad
+                assert_raises(ArgumentError) do
+                        Mahoro.compile "magic.sample\0"
+                end
+        end
 end
 
 # arch-tag: test