12345678910111213141516171819202122232425 |
- module Chervil
- RSpec.describe AST::Definition do
- it 'evaluates its body with its arguments when called' do
- env = Env.new
- expect(
- AST::Function.new(
- [
- AST::Identifier.new("x")
- ],
- [
- AST::Application.new(
- AST::Identifier.new("*"),
- [
- AST::Identifier.new("x"),
- AST::Identifier.new("x")
- ]
- )
- ],
- ).call(
- [AST::Number.new(5.0)]
- )
- ).to eq(25.0)
- end
- end
- end
|