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
// And then... | |
var square = c.func({ | |
'input': function () { | |
this.assert( arguments.length == 1, Error("Wrong number of arguments" ) ); | |
this.assert( typeof arguments[0] == 'number', Error('Argument is a number') ); | |
}, | |
'output': function () { | |
this.assert( typeof arguments[0] == 'number', Error('Output is a number') ); | |
}, | |
'body': function (target) { |
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
Feature: Addition | |
In order to avoid silly mistakes # These are inline `comments` in the | |
As a math idiot # form of an Agile User Story. They're | |
I want to be able to add two numbers # printed out during test execution. | |
Scenario: Add two numbers # This is a test case | |
Given I have entered 50 in to the calculator # This is a test *step* | |
And I have entered 70 in to the calculator # So is this | |
When I press add # And this | |
Then the result 120 should be on the screen # And the final one |
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
if ( shipment['gift_message'] ) { | |
print_gift_message( 'gift-message-printer', shipment['gift_message'] ); | |
} |
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
Given /I have entered (.*) into the calculator/ do |n| | |
calculator = Calculator.new # Create a new calculator object | |
calculator.push( n.to_i ) # | |
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
"TakeMeasurements": { | |
// Specify the inputs we require. `warehouse` and `product_measurable` are | |
// custom types defined elsewhere, where `warehouse` is an enumeration of | |
// the client's warehouses, and `product_measurable` is a boolean value | |
"inputs": ["Type::warehouse", "Type::product_measurable"], | |
// Guarantee the type we will return | |
"output": "Type::Boolean", | |
// The rule itself. Note how it neither gets or sets any values outside of |
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
"Type::warehouse": { | |
"constraint": create_enum('WH1', 'WH2'), | |
"cucumber": { | |
"type": "Given", | |
"match" : qr/the warehouse is "(WH\d)"/, | |
"describe": "the warehouse is \"{0}\"", | |
} | |
}, | |
"Type::product_measurable": { |
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
Scenario: | |
Given the warehouse is WH1 | |
Then we are not required to take measurements | |
Scenario: | |
When the product is not measurable | |
Then we are not required to take measurements | |
Scenario: | |
Given the warehouse is WH2 | |
When the product is measurable | |
Then we are required to take measurements |
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
#!perl | |
use strict; | |
# Accepts a grid size, and a list representing the grid. 131 | |
# characters. RUNS UNDER STRICTURES BABY YEAH. | |
my$life=sub{$a=shift;map{$b=$_[$_];my$n;$n+=$_[$_]for($_-$a-1..$_-$a+1,$_-1,$_+1,$_+$a-1..$_+$a+1);$n+$b==3||$b&&$n==4||0}0..$#_}; | |
my $result = join '', $life->( 5, qw/ |
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
package Roman; | |
use Moose; | |
sub AUTOLOAD { | |
our $AUTOLOAD; | |
(my $digits = $AUTOLOAD) =~ s/.+:://g; | |
$digits =~ s/$_->[0]/$_->[1]/ | |
for | |
[ IV => 'IIII' ], |
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
# Table parsing, old friend... We have spent many long evenings together, | |
# working through your broken tables, talking about your issues with | |
# implicit thead elements, and your quirky tr/th heuristics. But ... but | |
# but it's time for us to move on. We can't keep doing this. It's not you, | |
# it's me... | |
# | |
# I've ... I've met someone new. She's beautiful, she's modern, and she's | |
# elegant. She's logical, she's clean, and she's well-structured, if you | |
# know what I mean... | |
# |