Chervil is a toy Lisp interpreter written in Ruby
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

function_spec.rb 561B

12345678910111213141516171819202122232425
  1. module Chervil
  2. RSpec.describe AST::Definition do
  3. it 'evaluates its body with its arguments when called' do
  4. env = Env.new
  5. expect(
  6. AST::Function.new(
  7. [
  8. AST::Identifier.new("x")
  9. ],
  10. [
  11. AST::Application.new(
  12. AST::Identifier.new("*"),
  13. [
  14. AST::Identifier.new("x"),
  15. AST::Identifier.new("x")
  16. ]
  17. )
  18. ],
  19. ).call(
  20. [AST::Number.new(5.0)]
  21. )
  22. ).to eq(25.0)
  23. end
  24. end
  25. end