Skip to content

Commit

Permalink
Merge branch 'master' of github.com:sekiguchi-nagisa/arsh
Browse files Browse the repository at this point in the history
  • Loading branch information
sekiguchi-nagisa committed Feb 25, 2025
2 parents d65ea80 + 5fd23bc commit b8a5406
Show file tree
Hide file tree
Showing 32 changed files with 313 additions and 125 deletions.
70 changes: 70 additions & 0 deletions test/analyzer/cases/cancel.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# RUN: call $cmd --test $self --log info

{"id": 0, "jsonrpc": "2.0", "method": "initialize",
"params": {"capabilities": {}, "rootUri": "file:///test", "processId": 46}}

# CHECK: {
# CHECK_IF: "capabilities": {
# CHECK_IF: }

<<<
{"jsonrpc": "2.0", "method": "textDocument/didOpen",
"params": {
"textDocument": {"languageId": "arsh", "version": 1, "uri": "file:///test/test.ds",
"text": "var ZZZ = $false; { var ZAAA = 34; var ZE22 = 23; var Z000 = 23;"}
}
}

<<<
{"jsonrpc": "2.0", "method": "$/sleep",
"params": {
"msec": 200
}
}

<<<
{"id": 1, "jsonrpc": "2.0", "method": "textDocument/completion",
"params": {
"context": { "triggerKind": 1 },
"position": { "character": 2, "line": 1 },
"textDocument": { "uri": "file:///test/test/hoge.ds" }
}
}

<<<
{"jsonrpc": "2.0", "method": "$/cancelRequest",
"params": {
"id": 1
}
}

# CHECK_IF: "error": {
# CHECK: "code": -32800,
# CHECK: "message": "canceled"
# CHECK: },
# CHECK: "id": 1,
# CHECK: "jsonrpc": "2.0"
# CHECK: }

# CHECKERR_RE_IF: ^.+ <info> .+ try cancel: request id=1

# CHECKERR_RE_IF: ^.+ <info> .+ do cancel: request id=1


## invalid cancel
<<<
{"jsonrpc": "2.0", "method": "$/cancelRequest",
"params": {
"id": "nothing"
}
}

<<<
{"id": 2, "jsonrpc": "2.0", "method": "shutdown"}

# CHECK_IF: "result": null
# CHECK: }

<<<
{"jsonrpc": "2.0", "method": "exit"}
# STATUS: 0
4 changes: 3 additions & 1 deletion test/analyzer/cases/change_error.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
# CHECK: "params": {
# CHECK: "diagnostics": [],

---
# CHECKERR_RE_IF: ^.+ <error> .+ broken textDocument: file:///test/not-found

--- 50
{"id": 2, "jsonrpc": "2.0", "method": "shutdown"}

# CHECK_IF: "result": null
Expand Down
8 changes: 6 additions & 2 deletions test/analyzer/cases/completion_error.test
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@
}
}

# CHECK_IF: "code": -32602,
# CHECK: "message": "broken textDocument: file:///test/test/hoge.ds"
# CHECK_IF: "error": {
# CHECK: "code": -32602,
# CHECK: "message": "broken textDocument: file:///test/test/hoge.ds"
# CHECK: },
# CHECK: "id": 1,
# CHECK: "jsonrpc": "2.0"
# CHECK: }

<<<
Expand Down
9 changes: 6 additions & 3 deletions test/analyzer/cases/definition_error.test
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@
}
}

# CHECK_IF: {
# CHECK_IF: "code": -32602,
# CHECK: "message": "broken position at: file:///test/test.ds:-123:-10000"
# CHECK_IF: "error": {
# CHECK: "code": -32602,
# CHECK: "message": "broken position at: file:///test/test.ds:-123:-10000"
# CHECK: },
# CHECK: "id": 1,
# CHECK: "jsonrpc": "2.0"
# CHECK: }

<<<
Expand Down
9 changes: 7 additions & 2 deletions test/analyzer/cases/doc_highlight_error.test
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@
}
}

# CHECK_IF: "code": -32602,
# CHECK: "message": "broken textDocument: file:///test/test.ds234"
# CHECK_IF: "error": {
# CHECK: "code": -32602,
# CHECK: "message": "broken textDocument: file:///test/test.ds234"
# CHECK: },
# CHECK: "id": 1,
# CHECK: "jsonrpc": "2.0"
# CHECK: }


<<<
{"id": 2, "jsonrpc": "2.0", "method": "shutdown"}

Expand Down
8 changes: 6 additions & 2 deletions test/analyzer/cases/document_link_error.test
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@
}
}

# CHECK_IF: "code": -32602,
# CHECK: "message": "broken textDocument: file:///test/test.ds234"
# CHECK_IF: "error": {
# CHECK: "code": -32602,
# CHECK: "message": "broken textDocument: file:///test/test.ds234"
# CHECK: },
# CHECK: "id": 1,
# CHECK: "jsonrpc": "2.0"
# CHECK: }

<<<
Expand Down
8 changes: 6 additions & 2 deletions test/analyzer/cases/document_symbol_error.test
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@
}
}

# CHECK_IF: "code": -32602,
# CHECK: "message": "broken textDocument: file:///test/test.ds234"
# CHECK_IF: "error": {
# CHECK: "code": -32602,
# CHECK: "message": "broken textDocument: file:///test/test.ds234"
# CHECK: },
# CHECK: "id": 1,
# CHECK: "jsonrpc": "2.0"
# CHECK: }

<<<
Expand Down
8 changes: 6 additions & 2 deletions test/analyzer/cases/hover_error.test
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@
}
}

# CHECK_IF: "code": -32602,
# CHECK: "message": "broken textDocument: file:///test/test.ds234"
# CHECK_IF: "error": {
# CHECK: "code": -32602,
# CHECK: "message": "broken textDocument: file:///test/test.ds234"
# CHECK: },
# CHECK: "id": 1,
# CHECK: "jsonrpc": "2.0"
# CHECK: }

<<<
Expand Down
9 changes: 7 additions & 2 deletions test/analyzer/cases/initialize_already.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
{"id": 1, "jsonrpc": "2.0", "method": "initialize",
"params": {"capabilities": {}, "rootUri": "file:///test", "processId": 46}}

# CHECK_IF: "code": -32600,
# CHECK: "message": "server has already initialized"
# CHECK_IF: "error": {
# CHECK: "code": -32600,
# CHECK: "message": "server has already initialized"
# CHECK: },
# CHECK: "id": 1,
# CHECK: "jsonrpc": "2.0"
# CHECK: }

<<<
# STATUS: 137
11 changes: 7 additions & 4 deletions test/analyzer/cases/initialize_error1.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
{"id": 0, "jsonrpc": "2.0", "method": "initialize",
"params": {"capabilities---": {}, "rootUri": "file:///test", "processId": 46}}

# CHECK: {
# CHECK: "code": -32602,
# CHECK: "message": "undefined field `capabilities'"
# CHECK: }
# CHECK_IF: "error": {
# CHECK: "code": -32602,
# CHECK: "message": "undefined field `capabilities'"
# CHECK: },
# CHECK: "id": 0,
# CHECK: "jsonrpc": "2.0"
# CHECK: }

<<<
# STATUS: 137
11 changes: 7 additions & 4 deletions test/analyzer/cases/initialize_error2.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
{"id": 0, "jsonrpc": "2.0", "method": "initialize",
"params": {"capabilities": {}, "rootUri": "file:///test", "processId": true}}

# CHECK: {
# CHECK: "code": -32602,
# CHECK: "message": "require `null', but is `bool'"
# CHECK: }
# CHECK_IF: "error": {
# CHECK: "code": -32602,
# CHECK: "message": "require `null', but is `bool'"
# CHECK: },
# CHECK: "id": 0,
# CHECK: "jsonrpc": "2.0"
# CHECK: }

<<<
# STATUS: 137
15 changes: 10 additions & 5 deletions test/analyzer/cases/invalid_request1.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
{ "fare" : [
true, false]
}
# CHECK: {
# CHECK: "code": -32600,
# CHECK: "data": "undefined field `jsonrpc'",
# CHECK: "message": "Invalid Request"
# CHECK: }

# CHECK_IF: "error": {
# CHECK: "code": -32600,
# CHECK: "data": "undefined field `jsonrpc'",
# CHECK: "message": "Invalid Request"
# CHECK: },
# CHECK: "id": null,
# CHECK: "jsonrpc": "2.0"
# CHECK: }

<<<
# STATUS: 137
24 changes: 18 additions & 6 deletions test/analyzer/cases/invalid_request2.test
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
# RUN: call $cmd --test $self

23

# CHECK: {
# CHECK: "code": -32600,
# CHECK: "data": "require `object', but is `long'",
# CHECK: "message": "Invalid Request"
# CHECK: "error": {
# CHECK: "code": -32600,
# CHECK: "data": "require `object', but is `long'",
# CHECK: "message": "Invalid Request"
# CHECK: },
# CHECK: "id": null,
# CHECK: "jsonrpc": "2.0"
# CHECK: }

<<<
{ "34" : false}

# CHECK: {
# CHECK: "code": -32600,
# CHECK: "data": "undefined field `jsonrpc'",
# CHECK: "message": "Invalid Request"
# CHECK: "error": {
# CHECK: "code": -32600,
# CHECK: "data": "undefined field `jsonrpc'",
# CHECK: "message": "Invalid Request"
# CHECK: },
# CHECK: "id": null,
# CHECK: "jsonrpc": "2.0"
# CHECK: }

<<<
# STATUS: 137
4 changes: 3 additions & 1 deletion test/analyzer/cases/open_error.test
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
}
}

---
# CHECKERR_RE_IF: ^.+ <error> .+ broken uri: hoge hohge

--- 50
{"id": 2, "jsonrpc": "2.0", "method": "shutdown"}

# CHECK_IF: {
Expand Down
8 changes: 6 additions & 2 deletions test/analyzer/cases/prepare_rename_error.test
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@
}
}

# CHECK_IF: "code": -32602,
# CHECK: "message": "broken position at: file:///test/test.ds:0:-4"
# CHECK_IF: "error": {
# CHECK: "code": -32602,
# CHECK: "message": "broken position at: file:///test/test.ds:0:-4"
# CHECK: },
# CHECK: "id": 1,
# CHECK: "jsonrpc": "2.0"
# CHECK: }

<<<
Expand Down
8 changes: 6 additions & 2 deletions test/analyzer/cases/reference_error.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@
}
}

# CHECK_IF: "code": -32602,
# CHECK: "message": "broken uri: test.ds not found"
# CHECK_IF: "error": {
# CHECK: "code": -32602,
# CHECK: "message": "broken uri: test.ds not found"
# CHECK: },
# CHECK: "id": 1,
# CHECK: "jsonrpc": "2.0"
# CHECK: }

<<<
Expand Down
26 changes: 18 additions & 8 deletions test/analyzer/cases/rename_error1.test
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@
}
}

# CHECK_IF: "code": -32602,
# CHECK: "message": "broken position at: file:///test/test.ds:-23:3"
# CHECK_IF: "error": {
# CHECK: "code": -32602,
# CHECK: "message": "broken position at: file:///test/test.ds:-23:3"
# CHECK: },
# CHECK: "id": 1,
# CHECK: "jsonrpc": "2.0"
# CHECK: }


Expand All @@ -62,11 +66,14 @@
}
}

# CHECK_IF: "code": -32803,
# CHECK: "message": "cannot perform rename since builtin symbol"
# CHECK_IF: "error": {
# CHECK: "code": -32803,
# CHECK: "message": "cannot perform rename since builtin symbol"
# CHECK: },
# CHECK: "id": 2,
# CHECK: "jsonrpc": "2.0"
# CHECK: }


# rename failed since no symbol

<<<
Expand All @@ -81,11 +88,14 @@
}
}

# CHECK_IF: "code": -32803,
# CHECK: "message": "rename target must be symbol"
# CHECK_IF: "error": {
# CHECK: "code": -32803,
# CHECK: "message": "rename target must be symbol"
# CHECK: },
# CHECK: "id": 3,
# CHECK: "jsonrpc": "2.0"
# CHECK: }


<<<
{"id": 5, "jsonrpc": "2.0", "method": "shutdown"}

Expand Down
Loading

0 comments on commit b8a5406

Please sign in to comment.