test/term_test.rb in polynomials-0.1.7 vs test/term_test.rb in polynomials-0.2.0

- old
+ new

@@ -22,6 +22,18 @@ def test_parsing_variable_omitted assert_equal 6, Term.parse('6').coefficient assert_equal 0, Term.parse('6').exponent end + + def test_invalid_string_raises_not_parsable_error + ['6x^ -5', '6^20', '2 2', 'xx', '2 ^ x'].each do |not_parsable_string| + assert_raises NotParsableError do + term = Term.parse not_parsable_string + end + end + end + + def testing_to_s + assert_equal "+ 6 ", Term.parse('6').to_s + end end