Skip to content

Commit cb0a120

Browse files
committed
Add test for verifying send isn't valid on port
1 parent 6925299 commit cb0a120

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/gleam/erlang/port_test.gleam

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,19 @@ pub fn port_switchover_test() {
102102

103103
port.close(port)
104104
}
105+
106+
107+
pub fn port_subject_send_test() {
108+
let assert Ok(port) = port.open(
109+
port.spawn_executable("/bin/bash"),
110+
[port.Args(["-c", "cat"]), port.UseStdio, port.ExitStatus, port.Binary]
111+
)
112+
113+
let subject = port_subject(port)
114+
115+
116+
assert assert_panic(fn() { process.send(subject, Data(<<"hello">>)) })
117+
== "Cannot send on PortSubject"
118+
119+
port.close(port)
120+
}

0 commit comments

Comments
 (0)