This repository has been archived by the owner on Feb 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add behave for server and travis for CI
- Loading branch information
Showing
7 changed files
with
136 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
sudo: false | ||
language: python | ||
python: | ||
- 3.4 | ||
- 3.5 | ||
- 3.6 | ||
|
||
cache: | ||
pip: true | ||
directories: | ||
- node_modules | ||
|
||
os: | ||
- osx | ||
- linux | ||
|
||
# Note that in order to run the tests on Linux, | ||
# you need to have a before_install configuration | ||
# to enable Linux to start VS Code from the build. | ||
# ref https://code.visualstudio.com/Docs/extensions/testing-extensions | ||
before_install: | ||
- if [ $TRAVIS_OS_NAME == "linux" ]; then | ||
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0; | ||
sh -e /etc/init.d/xvfb start; | ||
sleep 3; | ||
fi | ||
|
||
install: | ||
- pip install -r ./requirements.txt | ||
# beheve is a dev dependeny, so not in requirements.txt. | ||
- pip install behave | ||
- cd ./vscode-client | ||
- npm install | ||
- mkdir ./out | ||
- npm run vscode:prepublish | ||
- cd - > /dev/null | ||
|
||
script: | ||
# Server side tests. | ||
- behave ./tests/server.features | ||
# # Integration tests. | ||
# - cd ./vscode-client | ||
# - npm test | ||
# - cd - > /dev/null | ||
|
||
# after_success: | ||
# # If the build was triggered by a tag, publish the new version | ||
# - 'if [[ $TRAVIS_TAG == v* ]]; then vsce publish -p $VSCE_TOKEN; fi' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# -*- coding: UTF-8 -*- | ||
|
||
# @mark.steps | ||
# ---------------------------------------------------------------------------- | ||
# STEPS: | ||
# ---------------------------------------------------------------------------- | ||
from behave import given, when, then | ||
from coala_langserver.uri import path_from_uri, dir_from_uri | ||
|
||
|
||
@given('There is a string with "file://"') | ||
def step_impl(context): | ||
context.str = 'file://Users' | ||
|
||
|
||
@when('I pass the string with the prefix to path_from_uri') | ||
def step_impl(context): | ||
context.path = path_from_uri(context.str) | ||
|
||
|
||
@given('There is a string without "file://"') | ||
def step_impl(context): | ||
context.str = '/Users' | ||
|
||
|
||
@when('I pass the string without the prefix to path_from_uri') | ||
def step_impl(context): | ||
context.path = path_from_uri(context.str) | ||
|
||
|
||
@then('it should return a string without "file://"') | ||
def step_impl(context): | ||
assert context.failed is False | ||
assert 'file://' not in context.path | ||
|
||
|
||
@when('I pass the string to dir_from_uri') | ||
def step_impl(context): | ||
context.path = dir_from_uri(context.str) | ||
|
||
|
||
@then('it should return the directory of the path') | ||
def step_impl(context): | ||
assert context.failed is False | ||
assert context.path is '/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Feature: uri module | ||
uri is a module of language-server. | ||
|
||
Scenario: Test path_from_uri | ||
Given There is a string with "file://" | ||
When I pass the string with the prefix to path_from_uri | ||
Then it should return a string without "file://" | ||
|
||
Scenario: Test path_from_uri | ||
Given There is a string without "file://" | ||
When I pass the string without the prefix to path_from_uri | ||
Then it should return a string without "file://" | ||
|
||
Scenario: Test dir_from_uri | ||
Given There is a string without "file://" | ||
When I pass the string to dir_from_uri | ||
Then it should return the directory of the path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
out | ||
server | ||
node_modules | ||
.vscode-dev | ||
.vscode-dev | ||
.vscode-test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// The module 'assert' provides assertion methods from node | ||
import * as assert from 'assert'; | ||
|
||
// You can import and use all API from the 'vscode' module | ||
// as well as import your extension to test it | ||
// import * as vscode from 'vscode'; | ||
// import * as myExtension from '../extension'; | ||
|
||
// Defines a Mocha test suite to group tests of similar kind together | ||
suite('Extension Tests', () => { | ||
|
||
// Defines a Mocha unit test | ||
test('Something 1', () => { | ||
assert.equal(-1, [1, 2, 3].indexOf(5)); | ||
assert.equal(-1, [1, 2, 3].indexOf(0)); | ||
}); | ||
}); |