Sha256: 1905d1845b7095e513a292a4c9bc391a31cb6573f47b16aa962101deb842e68e
Contents?: true
Size: 1.33 KB
Versions: 6
Compression:
Stored size: 1.33 KB
Contents
require "spec_helper" RSpec.describe ::Code::Error::TypeError do describe "Integer" do context "creating an integer with a non-number exponent" do it "raises" do expect { ::Code::Object::Integer.new(1, exponent: "2") }.to raise_error( described_class, ) end end [ '1 / ""', '1 ** ""', '1 % ""', '1 + ""', '1 - ""', '1 << ""', '1 >> ""', '1 & ""', '1 | ""', '1 ^ ""', '1 > ""', '1 >= ""', '1 < ""', '1 <= ""', ].each do |input| context input.inspect do it "raises" do expect { ::Code.evaluate(input) }.to raise_error(described_class) end end end end describe "Decimal" do context "creating an integer with a non-number exponent" do it "raises" do expect { ::Code::Object::Decimal.new(1, exponent: "2") }.to raise_error( described_class, ) end end [ '1.0 / ""', '1.0 ** ""', '1.0 * ""', '1.0 % ""', '1.0 + ""', '1.0 - ""', '1.0 > ""', '1.0 >= ""', '1.0 < ""', '1.0 <= ""', ].each do |input| context input.inspect do it "raises" do expect { ::Code.evaluate(input) }.to raise_error(described_class) end end end end end
Version data entries
6 entries across 6 versions & 2 rubygems