The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
assert_raise_message finds a bunch of (small) bugs

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Daniel Berger

Posts: 1383
Nickname: djberg96
Registered: Sep, 2004

Daniel Berger is a Ruby Programmer who also dabbles in C and Perl
assert_raise_message finds a bunch of (small) bugs Posted: Nov 26, 2008 9:35 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Daniel Berger.
Original Post: assert_raise_message finds a bunch of (small) bugs
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Daniel Berger
Latest Posts From Testing 1,2,3...

Advertisement
With the release of test-unit 2.0.1 and the addition of assert_raise_message, I thought I would go ahead and update win32-api to have certain error messages match up with what JRuby's FFI returned, and cleanup the return type error messages (which I realized were a little misleading).

So, naturally, I started with tests that looked something like this:
assert_raise_message("Illegal prototype 'X'"){ API.new('GetUserName', 'X', 'I', 'advapi32') }
assert_raise_message("Illegal return type 'Y'"){ API.new('GetUserName', 'PL', 'Y', 'advapi32') }

Simple enough. Except that they failed. The 'X' and 'Y' in quotes were either coming out empty or as garbage. Further inspection revealed the culprit:
rb_raise(cAPIError, "Illegal prototype '%s'", RARRAY(v_proto)->ptr[i]));

Whoops! I'd been trying to pass a literal VALUE as a C type. Once I fixed that (and several others like it) all was well.

Read: assert_raise_message finds a bunch of (small) bugs

Topic: Yet another Git convert Previous Topic   Next Topic Topic: Data Bank Gem

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use