| 1 |
#!/usr/bin/ruby |
|---|
| 2 |
# |
|---|
| 3 |
# Unit test for the BlueCloth class object |
|---|
| 4 |
# $Id: TEMPLATE.rb.tpl,v 1.2 2003/09/11 04:59:51 deveiant Exp $ |
|---|
| 5 |
# |
|---|
| 6 |
# Copyright (c) 2004 The FaerieMUD Consortium. |
|---|
| 7 |
# |
|---|
| 8 |
|
|---|
| 9 |
if !defined?( BlueCloth ) || !defined?( BlueCloth::TestCase ) |
|---|
| 10 |
basedir = File::dirname( __FILE__ ) |
|---|
| 11 |
require File::join( basedir, 'bctestcase' ) |
|---|
| 12 |
end |
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
### This test case tests ... |
|---|
| 16 |
class BlueClothClassTestCase < BlueCloth::TestCase |
|---|
| 17 |
|
|---|
| 18 |
TestString = "foo" |
|---|
| 19 |
|
|---|
| 20 |
def test_00_class_constant |
|---|
| 21 |
printTestHeader "BlueCloth: Class Constant" |
|---|
| 22 |
|
|---|
| 23 |
assert Object::constants.include?( "BlueCloth" ), |
|---|
| 24 |
"No BlueCloth constant in Object" |
|---|
| 25 |
assert_instance_of Class, BlueCloth |
|---|
| 26 |
end |
|---|
| 27 |
|
|---|
| 28 |
def test_01_instantiation |
|---|
| 29 |
printTestHeader "BlueCloth: Instantiation" |
|---|
| 30 |
rval = nil |
|---|
| 31 |
|
|---|
| 32 |
# With no argument... ("") |
|---|
| 33 |
assert_nothing_raised { |
|---|
| 34 |
rval = BlueCloth::new |
|---|
| 35 |
} |
|---|
| 36 |
assert_instance_of BlueCloth, rval |
|---|
| 37 |
assert_kind_of String, rval |
|---|
| 38 |
assert_equal "", rval |
|---|
| 39 |
|
|---|
| 40 |
# String argument |
|---|
| 41 |
assert_nothing_raised { |
|---|
| 42 |
rval = BlueCloth::new TestString |
|---|
| 43 |
} |
|---|
| 44 |
assert_instance_of BlueCloth, rval |
|---|
| 45 |
assert_kind_of String, rval |
|---|
| 46 |
assert_equal TestString, rval |
|---|
| 47 |
|
|---|
| 48 |
addSetupBlock { |
|---|
| 49 |
debugMsg "Creating a new BlueCloth" |
|---|
| 50 |
@obj = BlueCloth::new( TestString ) |
|---|
| 51 |
} |
|---|
| 52 |
addTeardownBlock { |
|---|
| 53 |
@obj = nil |
|---|
| 54 |
} |
|---|
| 55 |
end |
|---|
| 56 |
|
|---|
| 57 |
def test_02_duplication |
|---|
| 58 |
printTestHeader "BlueCloth: Duplication" |
|---|
| 59 |
rval = nil |
|---|
| 60 |
|
|---|
| 61 |
assert_nothing_raised { |
|---|
| 62 |
rval = @obj.dup |
|---|
| 63 |
} |
|---|
| 64 |
assert_instance_of BlueCloth, rval |
|---|
| 65 |
assert_kind_of String, rval |
|---|
| 66 |
assert_equal TestString, rval |
|---|
| 67 |
end |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
end |
|---|
| 71 |
|
|---|