Chervil is a toy Lisp interpreter written in Ruby
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

function_spec.rb 596B

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