forked from AtomLinter/linter-javac
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add specs for issue AtomLinter#94 - Add test to verify working symlinks as higher directories - Fix Directory-call, add fallback path for getProjectRootDir - Fix links, updated Latest Changes - Add subdirectory to fixtures - Refactor base-specs > getProjectDir's implementation is faulty since it does not proper handle the appearance of symlinks (see :251).
- Loading branch information
Florian Breisch
committed
May 26, 2016
1 parent
8148e0b
commit 6cc144f
Showing
7 changed files
with
111 additions
and
66 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
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,68 +1,56 @@ | ||
# This file contains all specs to ensure the base-functionality of | ||
# this plugin. | ||
|
||
_path = require 'path' | ||
|
||
|
||
_helpers = require _path.join(__dirname, '_spec-helpers.coffee') | ||
path = require 'path' | ||
|
||
_helpers = require path.join(__dirname, '_spec-helpers.coffee') | ||
|
||
describe 'linter-javac', -> | ||
beforeEach -> | ||
#atom.workspace.destroyActivePaneItem | ||
@linter = require path.join(__dirname, '..', 'lib', 'init.coffee') | ||
.provideLinter() | ||
waitsForPromise -> | ||
atom.packages.activatePackage 'linter-javac' | ||
atom.packages.activatePackage 'language-java' | ||
|
||
|
||
|
||
describe 'when using a faulty java-source file', -> | ||
beforeEach -> | ||
java_file = _path.join(__dirname, 'fixtures', 'BrokenWorld.java') | ||
atom.config.set 'linter-javac.verboseLogging', yes | ||
|
||
java_file = path.join(__dirname, 'fixtures', 'BrokenWorld.java') | ||
waitsForPromise => | ||
atom.workspace.open(java_file) | ||
.then (newtextEditor) => | ||
@textEditor = newtextEditor | ||
@linter = require(_path.join(__dirname, '..', 'lib', 'init.coffee')) | ||
.provideLinter() | ||
atom.workspace.open java_file | ||
.then (newtextEditor) => | ||
@textEditor = newtextEditor | ||
|
||
it 'returns at least 8 messages in the linter-message-object', -> | ||
waitsForPromise( => | ||
@linter.lint(@textEditor).then( (messages) -> | ||
expect(messages.length).toBeGreaterThan(7) | ||
) | ||
) | ||
|
||
|
||
waitsForPromise => | ||
@linter.lint(@textEditor).then (messages) -> | ||
expect messages.length | ||
.toBeGreaterThan 7 | ||
|
||
describe 'when using a correct java-source file', -> | ||
beforeEach -> | ||
java_file = _path.join(__dirname, 'fixtures', 'HelloWorld.java') | ||
java_file = path.join(__dirname, 'fixtures', 'HelloWorld.java') | ||
waitsForPromise => | ||
atom.workspace.open(java_file) | ||
.then (newtextEditor) => | ||
@textEditor = newtextEditor | ||
@linter = require(_path.join(__dirname, '..', 'lib', 'init.coffee')) | ||
.provideLinter() | ||
atom.workspace.open java_file | ||
.then (newtextEditor) => | ||
@textEditor = newtextEditor | ||
|
||
it 'returns an empty linter-message-object', -> | ||
result = {} | ||
expect(JSON.stringify(@linter.lint(@textEditor))) | ||
.toEqual(JSON.stringify(result)) | ||
|
||
|
||
expect JSON.stringify(@linter.lint(@textEditor)) | ||
.toEqual JSON.stringify(result) | ||
|
||
describe 'when using an empty java-source file', -> | ||
beforeEach -> | ||
java_file = _path.join(__dirname, 'fixtures', 'EmptyWorld.java') | ||
java_file = path.join(__dirname, 'fixtures', 'EmptyWorld.java') | ||
waitsForPromise => | ||
atom.workspace.open(java_file) | ||
.then (newtextEditor) => | ||
@textEditor = newtextEditor | ||
@linter = require(_path.join(__dirname, '..', 'lib', 'init.coffee')) | ||
.provideLinter() | ||
atom.workspace.open java_file | ||
.then (newtextEditor) => | ||
@textEditor = newtextEditor | ||
|
||
it 'returns an empty linter-message-object', -> | ||
result = {} | ||
expect(JSON.stringify(@linter.lint(@textEditor))) | ||
.toEqual(JSON.stringify(result)) | ||
expect JSON.stringify(@linter.lint(@textEditor)) | ||
.toEqual JSON.stringify(result) |
Empty file.
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,49 @@ | ||
# This file contains all dedicated to issue #94 | ||
# see: https://github.com/AtomLinter/linter-javac/issues/94 | ||
|
||
path = require 'path' | ||
|
||
_helpers = require path.join(__dirname, '_spec-helpers.coffee') | ||
|
||
describe 'linter-javac', -> | ||
beforeEach -> | ||
atom.config.set 'linter-javac.verboseLogging', yes | ||
waitsForPromise -> | ||
atom.packages.activatePackage 'linter-javac' | ||
atom.packages.activatePackage 'language-java' | ||
|
||
describe 'when using a symlink-dir as project-base', -> | ||
beforeEach -> | ||
java_file = path.join(__dirname, 'sym-fixtures', 'Test.java') | ||
@linter = require(path.join(__dirname, '..', 'lib', 'init.coffee')) | ||
.provideLinter() | ||
waitsForPromise => | ||
atom.workspace.open(java_file) | ||
.then (newtextEditor) => | ||
@textEditor = newtextEditor | ||
|
||
it 'shouldn not throw an exception if a file is saved', -> | ||
@textEditor.setText 'public class Test {}' | ||
linting = () => | ||
return @linter.lint(@textEditor) | ||
|
||
expect(linting).not.toThrow() | ||
|
||
describe 'when using a symlink as a higher directory of the project', -> | ||
beforeEach -> | ||
java_file = path.join( | ||
__dirname, 'sym-fixtures', 'sub-directory', 'Test.java' | ||
) | ||
@linter = require(path.join(__dirname, '..', 'lib', 'init.coffee')) | ||
.provideLinter() | ||
waitsForPromise => | ||
atom.workspace.open(java_file) | ||
.then (newtextEditor) => | ||
@textEditor = newtextEditor | ||
|
||
it 'shouldn not throw an exception if a file is saved', -> | ||
@textEditor.setText 'public class Test {}' | ||
linting = () => | ||
return @linter.lint(@textEditor) | ||
|
||
expect(linting).not.toThrow() |
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 @@ | ||
fixtures |