File: test_server_messages.py

package info (click to toggle)
fortran-language-server 3.2.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,268 kB
  • sloc: python: 9,688; f90: 1,195; fortran: 30; makefile: 28; ansic: 20
file content (30 lines) | stat: -rw-r--r-- 951 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from setup_tests import run_request, test_dir, write_rpc_request


def check_msg(ref, res):
    assert ref["type"] == res["type"]
    assert ref["message"] == res["message"]


# def test_config_file_non_existent():
#     string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir)})
#     errcode, results = run_request(string, ["-c", "fake.json"])
#
#     ref = {"type": 1, "message": "Configuration file 'fake.json' not found"}
#     assert errcode == 0
#     check_msg(ref, results[0])


def test_config_file_non_existent_options():
    string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir)})
    errcode, results = run_request(string, ["-c", "wrong_syntax.json"])

    ref = {
        "type": 1,
        "message": (
            'Error: "<string>:2 Unexpected "," at column 18" while reading'
            ' "wrong_syntax.json" Configuration file'
        ),
    }
    assert errcode == 0
    check_msg(ref, results[0])