From d02ecf53b03cce4c7c6f3dd7dc2abed66b712fbe Mon Sep 17 00:00:00 2001 From: Brendon Date: Wed, 20 Sep 2017 12:08:32 +0200 Subject: [PATCH] Add spec for lexer and change names of spec files --- exe/mm2ep-depend | 4 +- ...t => error_grammar_completely_invalid.txt} | 0 ...xt => error_grammar_partially_invalid.txt} | 0 spec/files/error_lexer_illegal_character.txt | 1 + spec/files/success_lexer_and_op.txt | 1 + spec/files/success_lexer_eq_op.txt | 1 + spec/files/success_lexer_f_bool.txt | 1 + spec/files/success_lexer_l_par.txt | 1 + spec/files/success_lexer_not_op.txt | 1 + spec/files/success_lexer_number.txt | 1 + spec/files/success_lexer_or_op.txt | 1 + spec/files/success_lexer_r_par.txt | 1 + spec/files/success_lexer_string.txt | 1 + spec/files/success_lexer_t_bool.txt | 1 + spec/files/success_lexer_var.txt | 1 + ...t_and.txt => success_priority_not_and.txt} | 0 ...not_or.txt => success_priority_not_or.txt} | 0 ...or_and.txt => success_priority_or_and.txt} | 0 ..._or.txt => success_priority_or_and_or.txt} | 0 ...xt => success_simple_eq_expr_boolexpr.txt} | 0 ....txt => success_simple_eq_expr_number.txt} | 0 ....txt => success_simple_eq_expr_string.txt} | 0 ...r.txt => success_simple_expr_and_expr.txt} | 0 ...pr.txt => success_simple_expr_or_expr.txt} | 0 ...t_expr.txt => success_simple_not_expr.txt} | 0 spec/mm2ep_depend/lexer_spec.rb | 94 +++++++++++++++++++ spec/mm2ep_depend/parser_spec.rb | 22 +++-- spec/mm2ep_depend/priority_parser_spec.rb | 22 +++-- spec/mm2ep_depend/simple_expr_parser_spec.rb | 66 +++++++------ 29 files changed, 172 insertions(+), 48 deletions(-) rename spec/files/{grammar_completely_invalid.txt => error_grammar_completely_invalid.txt} (100%) rename spec/files/{grammar_partially_invalid.txt => error_grammar_partially_invalid.txt} (100%) create mode 100644 spec/files/error_lexer_illegal_character.txt create mode 100644 spec/files/success_lexer_and_op.txt create mode 100644 spec/files/success_lexer_eq_op.txt create mode 100644 spec/files/success_lexer_f_bool.txt create mode 100644 spec/files/success_lexer_l_par.txt create mode 100644 spec/files/success_lexer_not_op.txt create mode 100644 spec/files/success_lexer_number.txt create mode 100644 spec/files/success_lexer_or_op.txt create mode 100644 spec/files/success_lexer_r_par.txt create mode 100644 spec/files/success_lexer_string.txt create mode 100644 spec/files/success_lexer_t_bool.txt create mode 100644 spec/files/success_lexer_var.txt rename spec/files/{priority_not_and.txt => success_priority_not_and.txt} (100%) rename spec/files/{priority_not_or.txt => success_priority_not_or.txt} (100%) rename spec/files/{priority_or_and.txt => success_priority_or_and.txt} (100%) rename spec/files/{priority_or_and_or.txt => success_priority_or_and_or.txt} (100%) rename spec/files/{simple_eq_expr_boolexpr.txt => success_simple_eq_expr_boolexpr.txt} (100%) rename spec/files/{simple_eq_expr_number.txt => success_simple_eq_expr_number.txt} (100%) rename spec/files/{simple_eq_expr_string.txt => success_simple_eq_expr_string.txt} (100%) rename spec/files/{simple_expr_and_expr.txt => success_simple_expr_and_expr.txt} (100%) rename spec/files/{simple_expr_or_expr.txt => success_simple_expr_or_expr.txt} (100%) rename spec/files/{simple_not_expr.txt => success_simple_not_expr.txt} (100%) create mode 100644 spec/mm2ep_depend/lexer_spec.rb diff --git a/exe/mm2ep-depend b/exe/mm2ep-depend index 283aa75..000a509 100755 --- a/exe/mm2ep-depend +++ b/exe/mm2ep-depend @@ -20,7 +20,7 @@ module Mm2ep vars.each do |var| tab_vars[var.split('=')[0]] = var.split('=')[1] end - + binding.pry # Give vars name and value from shell command to parser parser.names=tab_vars @@ -30,7 +30,7 @@ module Mm2ep puts "EVAL: #{token.to_s}" parser.check_grammar line, token - exit 1 unless !token.nil? && token.errors.empty? + exit 1 unless !token.nil? && token.errors.empty? puts "RESULT: #{token.compute}" diff --git a/spec/files/grammar_completely_invalid.txt b/spec/files/error_grammar_completely_invalid.txt similarity index 100% rename from spec/files/grammar_completely_invalid.txt rename to spec/files/error_grammar_completely_invalid.txt diff --git a/spec/files/grammar_partially_invalid.txt b/spec/files/error_grammar_partially_invalid.txt similarity index 100% rename from spec/files/grammar_partially_invalid.txt rename to spec/files/error_grammar_partially_invalid.txt diff --git a/spec/files/error_lexer_illegal_character.txt b/spec/files/error_lexer_illegal_character.txt new file mode 100644 index 0000000..a1e2647 --- /dev/null +++ b/spec/files/error_lexer_illegal_character.txt @@ -0,0 +1 @@ +? diff --git a/spec/files/success_lexer_and_op.txt b/spec/files/success_lexer_and_op.txt new file mode 100644 index 0000000..eb80eb4 --- /dev/null +++ b/spec/files/success_lexer_and_op.txt @@ -0,0 +1 @@ +AND diff --git a/spec/files/success_lexer_eq_op.txt b/spec/files/success_lexer_eq_op.txt new file mode 100644 index 0000000..3134d36 --- /dev/null +++ b/spec/files/success_lexer_eq_op.txt @@ -0,0 +1 @@ += diff --git a/spec/files/success_lexer_f_bool.txt b/spec/files/success_lexer_f_bool.txt new file mode 100644 index 0000000..dc7e9a6 --- /dev/null +++ b/spec/files/success_lexer_f_bool.txt @@ -0,0 +1 @@ +false False diff --git a/spec/files/success_lexer_l_par.txt b/spec/files/success_lexer_l_par.txt new file mode 100644 index 0000000..2d06f37 --- /dev/null +++ b/spec/files/success_lexer_l_par.txt @@ -0,0 +1 @@ +( diff --git a/spec/files/success_lexer_not_op.txt b/spec/files/success_lexer_not_op.txt new file mode 100644 index 0000000..bb96c79 --- /dev/null +++ b/spec/files/success_lexer_not_op.txt @@ -0,0 +1 @@ +NOT diff --git a/spec/files/success_lexer_number.txt b/spec/files/success_lexer_number.txt new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/spec/files/success_lexer_number.txt @@ -0,0 +1 @@ +7 diff --git a/spec/files/success_lexer_or_op.txt b/spec/files/success_lexer_or_op.txt new file mode 100644 index 0000000..c4a102d --- /dev/null +++ b/spec/files/success_lexer_or_op.txt @@ -0,0 +1 @@ +OR diff --git a/spec/files/success_lexer_r_par.txt b/spec/files/success_lexer_r_par.txt new file mode 100644 index 0000000..bea8cd1 --- /dev/null +++ b/spec/files/success_lexer_r_par.txt @@ -0,0 +1 @@ +) diff --git a/spec/files/success_lexer_string.txt b/spec/files/success_lexer_string.txt new file mode 100644 index 0000000..3511a2d --- /dev/null +++ b/spec/files/success_lexer_string.txt @@ -0,0 +1 @@ +"Arya Stark" diff --git a/spec/files/success_lexer_t_bool.txt b/spec/files/success_lexer_t_bool.txt new file mode 100644 index 0000000..def0ab8 --- /dev/null +++ b/spec/files/success_lexer_t_bool.txt @@ -0,0 +1 @@ +true True diff --git a/spec/files/success_lexer_var.txt b/spec/files/success_lexer_var.txt new file mode 100644 index 0000000..b855730 --- /dev/null +++ b/spec/files/success_lexer_var.txt @@ -0,0 +1 @@ +character diff --git a/spec/files/priority_not_and.txt b/spec/files/success_priority_not_and.txt similarity index 100% rename from spec/files/priority_not_and.txt rename to spec/files/success_priority_not_and.txt diff --git a/spec/files/priority_not_or.txt b/spec/files/success_priority_not_or.txt similarity index 100% rename from spec/files/priority_not_or.txt rename to spec/files/success_priority_not_or.txt diff --git a/spec/files/priority_or_and.txt b/spec/files/success_priority_or_and.txt similarity index 100% rename from spec/files/priority_or_and.txt rename to spec/files/success_priority_or_and.txt diff --git a/spec/files/priority_or_and_or.txt b/spec/files/success_priority_or_and_or.txt similarity index 100% rename from spec/files/priority_or_and_or.txt rename to spec/files/success_priority_or_and_or.txt diff --git a/spec/files/simple_eq_expr_boolexpr.txt b/spec/files/success_simple_eq_expr_boolexpr.txt similarity index 100% rename from spec/files/simple_eq_expr_boolexpr.txt rename to spec/files/success_simple_eq_expr_boolexpr.txt diff --git a/spec/files/simple_eq_expr_number.txt b/spec/files/success_simple_eq_expr_number.txt similarity index 100% rename from spec/files/simple_eq_expr_number.txt rename to spec/files/success_simple_eq_expr_number.txt diff --git a/spec/files/simple_eq_expr_string.txt b/spec/files/success_simple_eq_expr_string.txt similarity index 100% rename from spec/files/simple_eq_expr_string.txt rename to spec/files/success_simple_eq_expr_string.txt diff --git a/spec/files/simple_expr_and_expr.txt b/spec/files/success_simple_expr_and_expr.txt similarity index 100% rename from spec/files/simple_expr_and_expr.txt rename to spec/files/success_simple_expr_and_expr.txt diff --git a/spec/files/simple_expr_or_expr.txt b/spec/files/success_simple_expr_or_expr.txt similarity index 100% rename from spec/files/simple_expr_or_expr.txt rename to spec/files/success_simple_expr_or_expr.txt diff --git a/spec/files/simple_not_expr.txt b/spec/files/success_simple_not_expr.txt similarity index 100% rename from spec/files/simple_not_expr.txt rename to spec/files/success_simple_not_expr.txt diff --git a/spec/mm2ep_depend/lexer_spec.rb b/spec/mm2ep_depend/lexer_spec.rb new file mode 100644 index 0000000..7187389 --- /dev/null +++ b/spec/mm2ep_depend/lexer_spec.rb @@ -0,0 +1,94 @@ +require 'spec_helper' +require 'mm2ep_depend' + +describe Mm2ep::Depend::Lexer do + let(:lexer) do + Mm2ep::Depend::Lexer.new + end + + it 'has to recognize AND operator' do + line = File + .read(testfile('success_lexer_and_op.txt')).delete("\n") + lexer.input(line.chomp) + assert_equal('AND_OP', lexer.next.type.to_s) + end + + it 'has to recognize EQ operator' do + line = File + .read(testfile('success_lexer_eq_op.txt')).delete("\n") + lexer.input(line.chomp) + assert_equal('EQ_OP', lexer.next.type.to_s) + end + + it 'has to recognize OR operator' do + line = File + .read(testfile('success_lexer_or_op.txt')).delete("\n") + lexer.input(line.chomp) + assert_equal('OR_OP', lexer.next.type.to_s) + end + + it 'has to recognize NOT operator' do + line = File + .read(testfile('success_lexer_not_op.txt')).delete("\n") + lexer.input(line.chomp) + assert_equal('NOT_OP', lexer.next.type.to_s) + end + + it 'has to recognize false boolean' do + line = File + .read(testfile('success_lexer_f_bool.txt')).delete("\n") + lexer.input(line.chomp) + assert_equal('F_BOOL', lexer.next.type.to_s) + assert_equal('F_BOOL', lexer.next.type.to_s) + end + + it 'has to recognize true boolean' do + line = File + .read(testfile('success_lexer_t_bool.txt')).delete("\n") + lexer.input(line.chomp) + assert_equal('T_BOOL', lexer.next.type.to_s) + assert_equal('T_BOOL', lexer.next.type.to_s) + end + + it 'has to recognize left parenthesis' do + line = File + .read(testfile('success_lexer_l_par.txt')).delete("\n") + lexer.input(line.chomp) + assert_equal('L_PAR', lexer.next.type.to_s) + end + + it 'has to recognize right parenthesis' do + line = File + .read(testfile('success_lexer_r_par.txt')).delete("\n") + lexer.input(line.chomp) + assert_equal('R_PAR', lexer.next.type.to_s) + end + + it 'has to recognize number' do + line = File + .read(testfile('success_lexer_number.txt')).delete("\n") + lexer.input(line.chomp) + assert_equal('NUMBER', lexer.next.type.to_s) + end + + it 'has to recognize string' do + line = File + .read(testfile('success_lexer_string.txt')).delete("\n") + lexer.input(line.chomp) + assert_equal('STRING', lexer.next.type.to_s) + end + + it 'has to recognize var' do + line = File + .read(testfile('success_lexer_var.txt')).delete("\n") + lexer.input(line.chomp) + assert_equal('VAR', lexer.next.type.to_s) + end + + it 'has to recognize illegal character and replace them with erase them' do + line = File + .read(testfile('error_lexer_illegal_character.txt')).delete("\n") + lexer.input(line.chomp) + assert_equal('', lexer.next.to_s) + end +end diff --git a/spec/mm2ep_depend/parser_spec.rb b/spec/mm2ep_depend/parser_spec.rb index ff4250b..457c704 100644 --- a/spec/mm2ep_depend/parser_spec.rb +++ b/spec/mm2ep_depend/parser_spec.rb @@ -2,9 +2,15 @@ require 'spec_helper' require 'mm2ep_depend' describe Mm2ep::Depend::Parser do + let(:parser) do + Mm2ep::Depend::Parser.new( + Mm2ep::Depend::Lexer.new + ) + end + it 'has to report var which is not defined' do - line = File.read(testfile('simple_eq_expr_boolexpr.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_eq_expr_boolexpr.txt')).delete("\n") parser.names = {} token = parser.parse(line.chomp) token.errors @@ -14,8 +20,8 @@ describe Mm2ep::Depend::Parser do end it 'has to report vars which are not defined' do - line = File.read(testfile('simple_expr_or_expr.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_expr_or_expr.txt')).delete("\n") parser.names = {} token = parser.parse(line.chomp) token.errors @@ -25,8 +31,8 @@ describe Mm2ep::Depend::Parser do end it 'has to report invalid_grammar' do - line = File.read(testfile('grammar_partially_invalid.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('error_grammar_partially_invalid.txt')).delete("\n") parser.names = { 'a_girl_has_no_name' => true, 'character' => 'Arya Stark' } token = parser.parse(line.chomp) parser.check_grammar line, token @@ -36,8 +42,8 @@ describe Mm2ep::Depend::Parser do end it 'has to be nil when grammar is completely invalid' do - line = File.read(testfile('grammar_completely_invalid.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('error_grammar_completely_invalid.txt')).delete("\n") parser.names = {} token = parser.parse(line.chomp) parser.check_grammar line, token diff --git a/spec/mm2ep_depend/priority_parser_spec.rb b/spec/mm2ep_depend/priority_parser_spec.rb index 3774eec..878bc6e 100644 --- a/spec/mm2ep_depend/priority_parser_spec.rb +++ b/spec/mm2ep_depend/priority_parser_spec.rb @@ -2,30 +2,36 @@ require 'spec_helper' require 'mm2ep_depend' describe Mm2ep::Depend::Parser do + let(:parser) do + Mm2ep::Depend::Parser.new( + Mm2ep::Depend::Lexer.new + ) + end + it 'has to do not before or' do - line = File.read(testfile('priority_not_or.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_priority_not_or.txt')).delete("\n") token = parser.parse(line.chomp) assert_equal(false, token.compute) end it 'has to do not before and' do - line = File.read(testfile('priority_not_and.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_priority_not_and.txt')).delete("\n") token = parser.parse(line.chomp) assert_equal(true, token.compute) end it 'has to do and before or' do - line = File.read(testfile('priority_or_and.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_priority_or_and.txt')).delete("\n") token = parser.parse(line.chomp) assert_equal(false, token.compute) end it 'has to do and before or operators' do - line = File.read(testfile('priority_or_and_or.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_priority_or_and_or.txt')).delete("\n") token = parser.parse(line.chomp) assert_equal(true, token.compute) end diff --git a/spec/mm2ep_depend/simple_expr_parser_spec.rb b/spec/mm2ep_depend/simple_expr_parser_spec.rb index ba2d340..6dfa7d7 100644 --- a/spec/mm2ep_depend/simple_expr_parser_spec.rb +++ b/spec/mm2ep_depend/simple_expr_parser_spec.rb @@ -2,64 +2,70 @@ require 'spec_helper' require 'mm2ep_depend' describe Mm2ep::Depend::Parser do + let(:parser) do + Mm2ep::Depend::Parser.new( + Mm2ep::Depend::Lexer.new + ) + end + it 'has to apply not on expr' do - line = File.read(testfile('simple_not_expr.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_not_expr.txt')).delete("\n") token = parser.parse(line.chomp) assert_equal(false, token.compute) end it 'has to evaluate eq with bool expr and return true' do - line = File.read(testfile('simple_eq_expr_boolexpr.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_eq_expr_boolexpr.txt')).delete("\n") parser.names = { 'truc_bidule' => 'true' } token = parser.parse(line.chomp) assert_equal(true, token.compute) end it 'has to evaluate eq with bool expr and return false' do - line = File.read(testfile('simple_eq_expr_boolexpr.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_eq_expr_boolexpr.txt')).delete("\n") parser.names = { 'truc_bidule' => 'false' } token = parser.parse(line.chomp) assert_equal(false, token.compute) end it 'has to evaluate eq with number and return true' do - line = File.read(testfile('simple_eq_expr_number.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_eq_expr_number.txt')).delete("\n") parser.names = { 'truc_bidule' => '10' } token = parser.parse(line.chomp) assert_equal(true, token.compute) end it 'has to evaluate eq with number and return false' do - line = File.read(testfile('simple_eq_expr_number.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_eq_expr_number.txt')).delete("\n") parser.names = { 'truc_bidule' => '11' } token = parser.parse(line.chomp) assert_equal(false, token.compute) end it 'has to evaluate eq with string and return true' do - line = File.read(testfile('simple_eq_expr_string.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_eq_expr_string.txt')).delete("\n") parser.names = { 'truc_bidule' => 'test' } token = parser.parse(line.chomp) assert_equal(true, token.compute) end it 'has to evaluate eq with string and return false' do - line = File.read(testfile('simple_eq_expr_string.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_eq_expr_string.txt')).delete("\n") parser.names = { 'truc_bidule' => 'tes' } token = parser.parse(line.chomp) assert_equal(false, token.compute) end it 'has to evaluate true OR true and return true' do - line = File.read(testfile('simple_expr_or_expr.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_expr_or_expr.txt')).delete("\n") parser.names = { 'truc_bidule' => 'true', 'machin' => 'true' } token = parser.parse(line.chomp) @@ -67,8 +73,8 @@ describe Mm2ep::Depend::Parser do end it 'has to evaluate true OR false and return true' do - line = File.read(testfile('simple_expr_or_expr.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_expr_or_expr.txt')).delete("\n") parser.names = { 'truc_bidule' => 'true', 'machin' => 'false' } token = parser.parse(line.chomp) @@ -76,8 +82,8 @@ describe Mm2ep::Depend::Parser do end it 'has to evaluate false OR true and return true' do - line = File.read(testfile('simple_expr_or_expr.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_expr_or_expr.txt')).delete("\n") parser.names = { 'truc_bidule' => 'false', 'machin' => 'true' } token = parser.parse(line.chomp) @@ -85,8 +91,8 @@ describe Mm2ep::Depend::Parser do end it 'has to evaluate false OR false and return false' do - line = File.read(testfile('simple_expr_or_expr.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_expr_or_expr.txt')).delete("\n") parser.names = { 'truc_bidule' => 'false', 'machin' => 'false' } token = parser.parse(line.chomp) @@ -94,8 +100,8 @@ describe Mm2ep::Depend::Parser do end it 'has to evaluate true AND true and return true' do - line = File.read(testfile('simple_expr_and_expr.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_expr_and_expr.txt')).delete("\n") parser.names = { 'truc_bidule' => 'true', 'machin' => 'true' } token = parser.parse(line.chomp) @@ -103,8 +109,8 @@ describe Mm2ep::Depend::Parser do end it 'has to evaluate true AND false and return false' do - line = File.read(testfile('simple_expr_and_expr.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_expr_and_expr.txt')).delete("\n") parser.names = { 'truc_bidule' => 'true', 'machin' => 'false' } token = parser.parse(line.chomp) @@ -112,8 +118,8 @@ describe Mm2ep::Depend::Parser do end it 'has to evaluate false AND true and return false' do - line = File.read(testfile('simple_expr_and_expr.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_expr_and_expr.txt')).delete("\n") parser.names = { 'truc_bidule' => 'false', 'machin' => 'true' } token = parser.parse(line.chomp) @@ -121,8 +127,8 @@ describe Mm2ep::Depend::Parser do end it 'has to evaluate false AND false and return false' do - line = File.read(testfile('simple_expr_and_expr.txt')).delete("\n") - parser = Mm2ep::Depend::Parser.new(Mm2ep::Depend::Lexer.new) + line = File + .read(testfile('success_simple_expr_and_expr.txt')).delete("\n") parser.names = { 'truc_bidule' => 'false', 'machin' => 'false' } token = parser.parse(line.chomp)