Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added specs, fixed a few underlying issues with endless.rb
- Loading branch information
Michael Edgar
committed
Aug 2, 2010
1 parent
8bcbe88
commit f0e3770
Showing
8 changed files
with
58 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
require 'polyglot' | ||
require 'seamless/endless' | ||
require 'seamless/endless' | ||
|
||
class EndlessRubyPolyglotLoader | ||
def self.load(filename, options = nil, &block) | ||
Endless.load(filename) | ||
end | ||
end | ||
|
||
Polyglot.register("rbe", EndlessRubyPolyglotLoader) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class HelloThing | ||
def initialize(name) | ||
@name = name | ||
|
||
def run_ten_times() | ||
x = 0 | ||
result = [] | ||
while x < 10 | ||
x += 1 | ||
result << "Hello, #{@name}" | ||
result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class HelloWorlder | ||
def times_two | ||
return "Hello, world! Hello, world!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Rescueable | ||
class Rescued | ||
class << self | ||
def a_method | ||
begin | ||
raise "hai" | ||
rescue | ||
return 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def testing_method(arg) | ||
arg.to_s + ", " + arg.to_s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,27 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') | ||
|
||
describe "Seamless" do | ||
it "fails" do | ||
fail "hey buddy, you should probably rename this file and start specing for real" | ||
def load_example(name) | ||
require File.expand_path(File.dirname(__FILE__) + "/examples/#{name}") | ||
end | ||
|
||
it 'loads a simple method in endless form' do | ||
load_example 'simple' | ||
testing_method(50).should == '50, 50' | ||
end | ||
|
||
it 'loads a class in endless form' do | ||
load_example 'class' | ||
HelloThing.new('mike').run_ten_times.should == ['Hello, mike'] * 10 | ||
end | ||
|
||
it 'loads endlessly formed rescues' do | ||
load_example 'rescue' | ||
Rescueable::Rescued.a_method.should == 5 | ||
end | ||
|
||
it 'loads endless files with no newline at the end' do | ||
load_example 'no_newline_at_end' | ||
HelloWorlder.new.times_two.should == "Hello, world! Hello, world!" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters