From a9a262873450eaf5671747f846a6ec1e5f7d87c1 Mon Sep 17 00:00:00 2001 From: John Mettraux Date: Thu, 15 Aug 2024 16:38:17 +0900 Subject: [PATCH] Add Fugit::Nat.parse() spec input len > 256 gh-104 --- spec/nat_spec.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/nat_spec.rb b/spec/nat_spec.rb index e3be77a..a7c2c50 100644 --- a/spec/nat_spec.rb +++ b/spec/nat_spec.rb @@ -331,6 +331,11 @@ end end end + + it "rejects (returns nil) if input length > 256" do + + expect(Fugit::Nat.parse('a' * 5000)).to be(nil) + end end describe '.do_parse' do @@ -369,10 +374,10 @@ end end - it "fails with an ArgumentError when the input length > 256" do + it "fails with an ArgumentError if input length > 256" do - expect { Fugit::Nat.do_parse('a' * 5000) - }.to raise_error(ArgumentError, /too long .+ 5000 > 256/) + expect { Fugit::Nat.do_parse('a' * 5000) + }.to raise_error(ArgumentError, /too long .+ 5000 > 256/) end end end