Sha256: 774277884a5b22fe88a310f1a753b9f7b67a1efe72661dcd4fc21ce0573b81c7

Contents?: true

Size: 496 Bytes

Versions: 21

Compression:

Stored size: 496 Bytes

Contents

require "spec_helper"

RSpec.describe "function" do
  let(:timeout) { 0 }
  subject { Code.evaluate(input, timeout: timeout).to_s }

  [
    ["even? = (i) => { i.even? } even?(2)", "true"],
    ["even? = (i:) => { i.even? } even?(i: 2)", "true"],
    ["add = (a, b) => { a + b } add(1, 2)", "3"],
    ["minus = (a:, b:) => { a - b } minus(b: 1, a: 2)", "1"]
  ].each do |input, output|
    context input do
      let(:input) { input }
      it { expect(subject).to eq(output) }
    end
  end
end

Version data entries

21 entries across 21 versions & 3 rubygems

Version Path
template-ruby-0.5.6 spec/code/function_spec.rb
language-ruby-0.5.6 spec/code/function_spec.rb
code-ruby-0.5.6 spec/code/function_spec.rb
template-ruby-0.5.5 spec/code/function_spec.rb
language-ruby-0.5.5 spec/code/function_spec.rb
code-ruby-0.5.5 spec/code/function_spec.rb
template-ruby-0.5.4 spec/code/function_spec.rb
language-ruby-0.5.4 spec/code/function_spec.rb
code-ruby-0.5.4 spec/code/function_spec.rb
template-ruby-0.5.3 spec/code/function_spec.rb
language-ruby-0.5.3 spec/code/function_spec.rb
code-ruby-0.5.3 spec/code/function_spec.rb
template-ruby-0.5.2 spec/code/function_spec.rb
language-ruby-0.5.2 spec/code/function_spec.rb
code-ruby-0.5.2 spec/code/function_spec.rb
language-ruby-0.5.1 spec/code/function_spec.rb
template-ruby-0.5.1 spec/code/function_spec.rb
code-ruby-0.5.1 spec/code/function_spec.rb
template-ruby-0.5.0 spec/code/function_spec.rb
language-ruby-0.5.0 spec/code/function_spec.rb