Skip to content

Commit

Permalink
Add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Jun 5, 2023
1 parent 73ea787 commit aeb8a14
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/async/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,32 @@ def after
super
end

with '#annotate' do
it "can annotate the current task that has not started yet" do
task = Async::Task.new(reactor) do |task|
sleep
end

task.annotate("Hello World")

expect(task.annotation).to be == "Hello World"
end

it "can annotate the current task that has started" do
task = Async::Task.new(reactor) do |task|
task.annotate("Hello World")

sleep
end

expect(task.fiber).to be_nil

task.run

expect(task.fiber.annotation).to be == "Hello World"
end
end

with '.yield' do
it "can yield back to scheduler" do
state = nil
Expand Down

0 comments on commit aeb8a14

Please sign in to comment.