The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Heckle: Another Rubyconf Hack

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
Ryan Davis

Posts: 651
Nickname: zenspider
Registered: Oct, 2004

Ryan Davis is a ruby nerd.
Heckle: Another Rubyconf Hack Posted: Oct 22, 2006 2:05 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Ryan Davis.
Original Post: Heckle: Another Rubyconf Hack
Feed Title: Polishing Ruby
Feed URL: http://blog.zenspider.com/index.rdf
Feed Description: Musings on Ruby and the Ruby Community...
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Ryan Davis
Latest Posts From Polishing Ruby

Advertisement

Jester is a java test tool that finds code that is not covered by tests. It does this via bytecode mutation to modify code paths of the class under test. First it runs your tests and they should all pass (ass usual). Then it will modify conditionals for branching, change literals, and generally wreck havok, making one change at a time. By rerunning the tests per change, if they don't fail, then you've missed a test case. All in all this is pretty damn cool.

It turns out that getting a simple prototype up and running with 'if' node flipping takes about 100 lines of code. The meat of it is:

def process_defn(exp)
  self.method = exp.shift
  result = [:defn, method]

  result << process(exp.shift) until exp.empty?

  heckle(result) if should_heckle?

  return result
end

def process_if(exp)
  cond = process(exp.shift)
  t = process(exp.shift)
  f = process(exp.shift)

  if should_heckle? then
    [:if, cond, f, t]
  else
    [:if, cond, t, f]
  end
end

I've named it heckle and released it on rubyforge and Kevin Clark went insane last night and poured through it, ruby2ruby, and ParseTree to dig deeper. I haven't seen him this morning yet so I don't know if he's succeeded extending it yet. We'll see. There will be a more official release soon.

Read: Heckle: Another Rubyconf Hack

Topic: RubyConf 2007 Previous Topic   Next Topic Topic: Render Great-looking Collages with Ruby and RMagick

Sponsored Links



Google
  Web Artima.com   

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