00_class.tests.rb

来自「用ruby on rails写的一个博客程序,还不错..ruby on rail」· RB 代码 · 共 72 行

RB
72
字号
#!/usr/bin/ruby## Unit test for the BlueCloth class object # $Id: TEMPLATE.rb.tpl,v 1.2 2003/09/11 04:59:51 deveiant Exp $## Copyright (c) 2004 The FaerieMUD Consortium.# if !defined?( BlueCloth ) || !defined?( BlueCloth::TestCase )	basedir = File::dirname( __FILE__ )	require File::join( basedir, 'bctestcase' )end### This test case tests ...class BlueClothClassTestCase < BlueCloth::TestCase	TestString = "foo"	def test_00_class_constant		printTestHeader "BlueCloth: Class Constant"		assert Object::constants.include?( "BlueCloth" ),			"No BlueCloth constant in Object"		assert_instance_of Class, BlueCloth	end	def test_01_instantiation		printTestHeader "BlueCloth: Instantiation"		rval = nil				# With no argument... ("")		assert_nothing_raised {			rval = BlueCloth::new		}		assert_instance_of BlueCloth, rval		assert_kind_of String, rval		assert_equal "", rval		# String argument		assert_nothing_raised {			rval = BlueCloth::new TestString		}		assert_instance_of BlueCloth, rval		assert_kind_of String, rval		assert_equal TestString, rval		addSetupBlock {			debugMsg "Creating a new BlueCloth"			@obj = BlueCloth::new( TestString )		}		addTeardownBlock {			@obj = nil		}	end	def test_02_duplication		printTestHeader "BlueCloth: Duplication"		rval = nil				assert_nothing_raised {			rval = @obj.dup		}		assert_instance_of BlueCloth, rval		assert_kind_of String, rval		assert_equal TestString, rval	endend

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?