Skip to content

Commit

Permalink
Add test for calling Whisper::Params#on_new_segment multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
KitaitiMakoto committed Oct 24, 2024
1 parent ed92e37 commit 7ec606b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bindings/ruby/tests/test_segment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ def test_on_new_segment
assert_match /ask not what your country can do for you, ask what you can do for your country/, seg.text
end

def test_on_new_segment_twice
params = Whisper::Params.new
seg = nil
params.on_new_segment do |segment|
seg = segment
return
end
params.on_new_segment do |segment|
assert_same seg, segment
return
end
whisper.transcribe(File.join(TOPDIR, '..', '..', 'samples', 'jfk.wav'), params)
end

private

def whisper
Expand Down

0 comments on commit 7ec606b

Please sign in to comment.