Chervil is a toy Lisp interpreter written in Ruby
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

env_spec.rb 323B

123456789101112131415
  1. module Chervil
  2. RSpec.describe Env do
  3. it 'has arithmetic from core' do
  4. env = Env.new
  5. expect(env.get("+").call(1, 2)).to eq(3)
  6. end
  7. it 'inherits from parent env' do
  8. parent = Env.new
  9. parent.set("x", 5)
  10. child = Env.new(parent)
  11. expect(child.get("x")).to eq(5)
  12. end
  13. end
  14. end