Class: MahoroTestCase

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
ext/mahoro-0.1/test.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ MahoroTestCase

Returns a new instance of MahoroTestCase.



8
9
10
11
# File 'ext/mahoro-0.1/test.rb', line 8

def initialize(*args)
	super
	@m = Mahoro.new
end

Instance Method Details

#test_bufferObject



23
24
25
26
27
# File 'ext/mahoro-0.1/test.rb', line 23

def test_buffer
	@m.flags = Mahoro::NONE
	assert_equal('ASCII C program text',
	             @m.buffer(File.read('mahoro.c')))
end

#test_fileObject



13
14
15
16
# File 'ext/mahoro-0.1/test.rb', line 13

def test_file
	@m.flags = Mahoro::NONE
	assert_equal('ASCII C program text', @m.file('mahoro.c'))
end

#test_mime_bufferObject



29
30
31
32
33
# File 'ext/mahoro-0.1/test.rb', line 29

def test_mime_buffer
	@m.flags = Mahoro::MIME
	assert_equal('text/x-c; charset=us-ascii',
	             @m.buffer(File.read('mahoro.c')))
end

#test_mime_fileObject



18
19
20
21
# File 'ext/mahoro-0.1/test.rb', line 18

def test_mime_file
	@m.flags = Mahoro::MIME
	assert_equal('text/x-c; charset=us-ascii', @m.file('mahoro.c'))
end

#test_validObject



35
36
37
# File 'ext/mahoro-0.1/test.rb', line 35

def test_valid
	assert(@m.valid?, 'Default database was not valid.')
end