Skip to content

Commit

Permalink
Add multi thread test
Browse files Browse the repository at this point in the history
  • Loading branch information
zyc9012 committed Sep 4, 2024
1 parent 121e688 commit 26f4906
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/multi_thread_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'spec_helper'

describe "Multi threading" do
it 'should be thread-safe' do
10000.times.map do
Thread.new do
random_str = (0...32).map { (65 + rand(58)).chr }.join
doc = Nokolexbor::HTML('<div><a class="a">' + random_str + '</a></div>')
_(doc.css("div ::text").text).must_equal random_str
end
end.each(&:join)
end
end

0 comments on commit 26f4906

Please sign in to comment.