-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass to check poison op #33
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,26 @@ | ||||||||||||||||
defmodule CallTest do | ||||||||||||||||
use ExUnit.Case, async: true | ||||||||||||||||
import ExUnit.CaptureLog | ||||||||||||||||
|
||||||||||||||||
test "if with value" do | ||||||||||||||||
line = __ENV__.line + 10 | ||||||||||||||||
|
||||||||||||||||
log = | ||||||||||||||||
capture_log(fn -> | ||||||||||||||||
assert_raise RuntimeError, fn -> | ||||||||||||||||
defmodule CallingAbsentFunc do | ||||||||||||||||
use Charms | ||||||||||||||||
alias Charms.{Pointer, Term} | ||||||||||||||||
|
||||||||||||||||
defm get(env, i) :: Term.t() do | ||||||||||||||||
AbsentMod.absent_fun(env, i) | ||||||||||||||||
func.return(i) | ||||||||||||||||
end | ||||||||||||||||
Comment on lines
+15
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unreachable code in the The Consider removing the unreachable code: defm get(env, i) :: Term.t() do
AbsentMod.absent_fun(env, i)
- func.return(i)
end This change will make the function's intent clearer without affecting the test's behavior. 📝 Committable suggestion
Suggested change
|
||||||||||||||||
end | ||||||||||||||||
end | ||||||||||||||||
end) | ||||||||||||||||
|
||||||||||||||||
assert log =~ "Unknown intrinsic: AbsentMod.absent_fun/2" | ||||||||||||||||
assert log =~ "#{__ENV__.file}:#{line}" | ||||||||||||||||
end | ||||||||||||||||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider defining a custom exception for poison operations
Currently, the code raises a generic exception with a custom message when a poison operation is detected. Defining a custom exception, such as
PoisonOperationError
, would make error handling more explicit and allow for more precise exception matching downstream.Example: