Sha256: ef39001670627c4b53f96f37741c815e888a45dbc78c09e85c6c3ed97f4696b4

Contents?: true

Size: 857 Bytes

Versions: 1

Compression:

Stored size: 857 Bytes

Contents

#!/usr/bin/env ruby

require 'test/unit'
require 'mahoro'

class MahoroTestCase < Test::Unit::TestCase

	def setup
		@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({
		  'text/x-c; charset=us-ascii' => true,
		  'text/x-c charset=us-ascii' => true
		}.include?(@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({
		  '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
		assert(@m.valid?, 'Default database was not valid.')
	end

end

# arch-tag: test

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mahoro-0.2 test.rb