From 025ad7bb76590d3360750d5617b235a23908e5bb Mon Sep 17 00:00:00 2001 From: John Mettraux Date: Thu, 15 Aug 2024 17:01:44 +0900 Subject: [PATCH] Bring in spec helpers from raabro --- spec/parse_spec.rb | 7 +++++++ spec/spec_helper.rb | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/spec/parse_spec.rb b/spec/parse_spec.rb index 13e7fea..2f40cdc 100644 --- a/spec/parse_spec.rb +++ b/spec/parse_spec.rb @@ -111,6 +111,13 @@ expect(o).to eq(n) end end + + it "returns nil quickly if the input is useless and long, gh-104" do + + o = Fugit.parse('0 0' + ' 0' * 10_000 + ' 1 jan * UTC') +p o +# TODO + end end describe '.do_parse' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9e9a8d7..9331c62 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -68,6 +68,17 @@ def unrequire_chronic Object.send(:remove_const, :Chronic) end + + def monow; Process.clock_gettime(Process::CLOCK_MONOTONIC); end + + def do_time(&block) + + t0 = monow + + r = block.call + + [ r, monow - t0 ] + end end # Helpers RSpec.configure do |c|