Skip to content

Commit

Permalink
Add Windows CI (sublimelsp#1765)
Browse files Browse the repository at this point in the history
  • Loading branch information
rwols authored and AgentOfChaos committed Jul 2, 2021
1 parent 5873cb5 commit effac81
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ env:
UNITTESTING_TAG: master

jobs:
Windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- run: (new-object net.webclient).DownloadFile("https://raw.githubusercontent.com/SublimeText/UnitTesting/master/sbin/github.ps1","github.ps1")
- run: python tests/server.py --version
- run: python tests/adjust_unittesting_config_for_ci.py
- run: |
./github.ps1 "bootstrap" -verbose
./github.ps1 "install_package_control" -verbose
./github.ps1 "run_tests" -coverage -verbose
name: Run UnitTesting tests
macOS:
runs-on: macos-latest
steps:
Expand Down
18 changes: 4 additions & 14 deletions tests/test_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from os import environ
from os.path import dirname, pathsep
from unittesting import DeferrableTestCase
import unittest
import sys

test_file_path = dirname(__file__) + "/testfile.txt"

Expand Down Expand Up @@ -97,7 +99,7 @@ def test_disabled_capabilities(self):
self.assertTrue(config.is_disabled_capability("completionProvider.triggerCharacters"))
# But not this sub path
self.assertFalse(config.is_disabled_capability("completionProvider.resolveProvider"))
# The entire codeActionProvider is disabld
# The entire codeActionProvider is disabled
self.assertTrue(config.is_disabled_capability("codeActionProvider"))
# If codeActionProvider is disabled, all of its sub paths should be disabled as well
self.assertTrue(config.is_disabled_capability("codeActionProvider.codeActionKinds"))
Expand All @@ -117,6 +119,7 @@ def test_filter_out_disabled_capabilities_ignore_partially(self):
self.assertNotIn("triggerCharacters", options)
self.assertIn("resolveProvider", options)

@unittest.skipIf(sys.platform.startswith("win"), "requires non-Windows")
def test_path_maps(self):
config = read_client_config("asdf", {
"command": ["asdf"],
Expand All @@ -129,32 +132,19 @@ def test_path_maps(self):
{
"local": "/home/user/projects/another",
"remote": "/workspace2"
},
{
"local": "C:/Documents",
"remote": "/workspace3"
}
]
})
uri = config.map_client_path_to_server_uri("/home/user/projects/myproject/file.js")
self.assertEqual(uri, "file:///workspace/file.js")
uri = config.map_client_path_to_server_uri("/home/user/projects/another/foo.js")
self.assertEqual(uri, "file:///workspace2/foo.js")
uri = config.map_client_path_to_server_uri("C:/Documents/bar.ts")
self.assertEqual(uri, "file:///workspace3/bar.ts")
uri = config.map_client_path_to_server_uri("/some/path/with/no/mapping.py")
self.assertEqual(uri, "file:///some/path/with/no/mapping.py")
path = config.map_server_uri_to_client_path("file:///workspace/bar.html")
self.assertEqual(path, "/home/user/projects/myproject/bar.html")
path = config.map_server_uri_to_client_path("file:///workspace2/style.css")
self.assertEqual(path, "/home/user/projects/another/style.css")
path = config.map_server_uri_to_client_path("file:///workspace3/bar.ts")
self.assertEqual(path, "C:/Documents/bar.ts")

# FIXME: What if the server is running on a Windows VM,
# but locally we are running Linux?
path = config.map_server_uri_to_client_path("file:///c%3A/dir%20ectory/file.txt")
self.assertEqual(path, "/c:/dir ectory/file.txt")

# Test to_encoded_filename
uri, position = get_uri_and_position_from_location({
Expand Down

0 comments on commit effac81

Please sign in to comment.