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
#include <cstdio> | |
template <typename T> | |
class Array { | |
T _data[10]; | |
size_t _length; | |
public: | |
size_t length() const { return _length; } | |
T& operator[](const size_t i) { return _data[i]; } |
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
import codecs | |
import sys | |
fname = sys.argv[1] | |
f = codecs.open(fname, 'w', 'utf-8') | |
f.write(u'\xed') | |
f.close() |
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
I'm being run before each 'it' | |
.I'm being run before each 'it' | |
.I'm being run once before the 'it's in my scope | |
FFF | |
Failures: | |
1) Router#handle runs the correct handler when multiple handlers have been added returns 1 for / | |
Failure/Error: @router.get '/' do 1 end | |
undefined method `get' for nil:NilClass | |
# ./spec/router_spec.rb:21:in `block (3 levels) in <top (required)>' |
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
class Router | |
def initialize | |
@routes = {} | |
end | |
def get(str, &block) | |
@routes[str] = block | |
end | |
def handle(req) |
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
require_relative '../router' | |
describe Router, "#handle" do | |
before do | |
puts "I'm being run before each 'it'" | |
@router = Router.new | |
end | |
it "raises an ArgumentError on empty request string" do | |
lambda{@router.handle("")}.should raise_error(ArgumentError) |