1
0
Fork 0
mirror of https://github.com/laravel-ls/protocol.git synced 2026-06-18 21:10:03 +02:00

adding LSP rcp error codes

This commit is contained in:
Henrik Hautakoski 2026-02-02 19:11:35 +01:00
parent 3ce51072ee
commit 59661d5961
2 changed files with 89 additions and 0 deletions

38
rpc_test.go Normal file
View file

@ -0,0 +1,38 @@
package protocol_test
import (
"testing"
"github.com/laravel-ls/protocol"
)
func Test_IsLspRPCErrorCode(t *testing.T) {
if protocol.IsLspRPCErrorCode(5000) {
t.Errorf("5000 is not a valid code, but function returned true")
}
if protocol.IsLspRPCErrorCode(-9000) {
t.Errorf("-9000 is not a valid code, but function returned true")
}
if protocol.IsLspRPCErrorCode(-32899) == false {
t.Errorf("-32899 is a valid code, but function returned false")
}
if protocol.IsLspRPCErrorCode(-32840) == false {
t.Errorf("-32840 is a valid code, but function returned false")
}
if protocol.IsLspRPCErrorCode(-32800) == false {
t.Errorf("-32800 is a valid code, but function returned false")
}
// Exception
if protocol.IsLspRPCErrorCode(-32001) == false {
t.Errorf("-32001 is a valid code, but function returned false")
}
if protocol.IsLspRPCErrorCode(-32002) == false {
t.Errorf("-32002 is a valid code, but function returned false")
}
}