Sha256: 46d9b7cefbfe52165b441913f717fb73c820ac75a9f17a314f88fcfa840a8987
Contents?: true
Size: 1.71 KB
Versions: 2
Compression:
Stored size: 1.71 KB
Contents
############################################################################ # tc_win32_api.rb # # Test case for the Win32::API class. You should run this as Rake task, # i.e. 'rake test', instead of running it directly. ############################################################################ require 'win32/api' require 'test/unit' include Win32 class TC_Win32_API < Test::Unit::TestCase def setup @buf = 0.chr * 260 @api = API.new('GetCurrentDirectory', 'LP') end def test_version assert_equal('1.0.0', API::VERSION) end def test_call assert_respond_to(@api, :call) assert_nothing_raised{ @api.call(@buf.length, @buf) } assert_equal(Dir.pwd.tr('/', "\\"), @buf.strip) end def test_dll_name assert_respond_to(@api, :dll_name) assert_equal('kernel32', @api.dll_name) end def test_function_name assert_respond_to(@api, :function_name) assert_equal('GetCurrentDirectory', @api.function_name) end def test_prototype assert_respond_to(@api, :prototype) assert_equal(['L', 'P'], @api.prototype) end def test_return_type assert_respond_to(@api, :return_type) assert_equal('L', @api.return_type) end def test_constructor_expected_failures assert_raise(API::Error){ API.new('GetUserName', 'PL', 'I', 'foo') } assert_raise(API::Error){ API.new('GetUserName', 'X', 'I', 'foo') } assert_raise(API::Error){ API.new('GetUserName', 'PL', 'X', 'foo') } end def test_call_expected_failures assert_raise(TypeError){ @api.call('test', @buf) } end def teardown @buf = nil @api = nil end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
win32-api-1.0.0-mswin32 | test/tc_win32_api.rb |
win32-api-1.0.0 | test/tc_win32_api.rb |