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 test cases for diagnostic
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 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
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,7 @@ | ||
Feature: diagnostic module | ||
diagnostic is a module of language-server. | ||
|
||
Scenario: Test output_to_diagnostics | ||
Given the output with errors by coala | ||
When I pass the parameters to output_to_diagnostics | ||
Then it should return output in vscode format |
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,35 @@ | ||
# -*- coding: UTF-8 -*- | ||
|
||
# @mark.steps | ||
# ---------------------------------------------------------------------------- | ||
# STEPS: | ||
# ---------------------------------------------------------------------------- | ||
import os | ||
from behave import given, when, then | ||
from coala_langserver.diagnostic import output_to_diagnostics | ||
from coala_langserver.coalashim import run_coala_with_specific_file | ||
|
||
|
||
@given('the output with errors by coala') | ||
def step_impl(context): | ||
context.dir = os.path.abspath( | ||
os.path.join( | ||
os.path.dirname(os.path.abspath(__file__)), | ||
os.pardir, | ||
os.pardir, | ||
'resources' | ||
) | ||
) | ||
context.path = os.path.join(context.dir, 'unqualified.py') | ||
|
||
context.output = run_coala_with_specific_file(context.dir, context.path) | ||
|
||
|
||
@when('I pass the parameters to output_to_diagnostics') | ||
def step_impl(context): | ||
context.message = output_to_diagnostics(context.output) | ||
|
||
|
||
@then('it should return output in vscode format') | ||
def step_impl(context): | ||
assert len(context.message) is not 0 |