Sha256: 15711ef020ca4127116991643ad49ebc249350130a0e1e38b7df5f89683c3e2c
Contents?: true
Size: 1014 Bytes
Versions: 6
Compression:
Stored size: 1014 Bytes
Contents
# frozen_string_literal: true require_relative '../../spec_helper' require_relative '../../../lib/rley/syntax/terminal' # Load the class under test require_relative '../../../lib/rley/lexical/literal' module Rley # Open this namespace to avoid module qualifier prefixes module Lexical # Open this namespace to avoid module qualifier prefixes describe Literal do let(:lexeme) { '12.34' } let(:a_terminal) { Syntax::Terminal.new('NUMBER') } let(:a_pos) { Position.new(3, 4) } context 'Initialization:' do # Default instantiation rule subject { Literal.new(lexeme.to_f, lexeme, a_terminal, a_pos) } it 'should be created with a value, lexeme, terminal and position' do expect { Literal.new(lexeme.to_f, lexeme, a_terminal, a_pos) }.not_to raise_error end it 'should know its value' do expect(subject.value).to eq(lexeme.to_f) end end # context end # describe end # module end # module # End of file
Version data entries
6 entries across 6 versions & 1 rubygems