123456789101112131415161718192021 |
- RSpec.describe AST::ForLoop do
- it 'evaluates' do
- expect {
- AST::ForLoop.new(
- AST::Identifier.new('x'),
- AST::Array.new(
- [AST::Number.new(1.0), AST::Number.new(2.0), AST::Number.new(3.0)]
- ),
- AST::Block.new(
- [
- AST::FunctionCall.new(
- AST::Identifier.new('print'),
- [AST::Identifier.new('x')]
- )
- ]
- )
- )
- .execute(Environment.new)
- }.to output("1.0\n2.0\n3.0\n").to_stdout
- end
- end
|