diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-01-30 07:28:13 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-01-30 07:28:13 +0000 |
commit | 480219900f3d47c7b9ddf830a1e19b4aa39e83e2 (patch) | |
tree | c51ab357ed0ee98e39490a042288730766d803d7 /test.rb | |
download | mahoro-480219900f3d47c7b9ddf830a1e19b4aa39e83e2.tar.gz |
initial import v0.1
Diffstat (limited to 'test.rb')
-rwxr-xr-x | test.rb | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -0,0 +1,41 @@ +#!/usr/bin/env ruby + +require 'test/unit' +require 'mahoro' + +class MahoroTestCase < Test::Unit::TestCase + + def initialize(*args) + super + @m = Mahoro.new + end + + def test_file + @m.flags = Mahoro::NONE + assert_equal('ASCII C program text', @m.file('mahoro.c')) + end + + def test_mime_file + @m.flags = Mahoro::MIME + assert_equal('text/x-c; charset=us-ascii', @m.file('mahoro.c')) + end + + def test_buffer + @m.flags = Mahoro::NONE + assert_equal('ASCII C program text', + @m.buffer(File.read('mahoro.c'))) + end + + def test_mime_buffer + @m.flags = Mahoro::MIME + assert_equal('text/x-c; charset=us-ascii', + @m.buffer(File.read('mahoro.c'))) + end + + def test_valid + assert(@m.valid?, 'Default database was not valid.') + end + +end + +# arch-tag: test |