-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: convert ludown to bf-lu (#1608)
* convert ludown to bf-lu * update the version * update the lu diagnostic * update the version * fix lu files * update the file * add some unit test * update some function * update version to fix bf-lu error * fix: show lg templete * update the lu index
- Loading branch information
1 parent
626a3ad
commit 7594a26
Showing
24 changed files
with
1,036 additions
and
530 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
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
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
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
62 changes: 62 additions & 0 deletions
62
Composer/packages/lib/indexers/__tests__/utils/diagnosticUtil.test.ts
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,62 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { createSingleMessage, combineMessage, findErrors, isValid } from '../../src/utils'; | ||
|
||
const diagnostics = [ | ||
{ | ||
message: 'syntax error', | ||
range: { start: { line: 15, character: 0 }, end: { line: 15, character: 1 } }, | ||
severity: 0, | ||
source: 'a.lu', | ||
}, | ||
{ | ||
message: 'syntax error', | ||
range: { start: { line: 0, character: 0 }, end: { line: 0, character: 1 } }, | ||
severity: 0, | ||
source: 'b.lu', | ||
}, | ||
{ | ||
message: 'syntax error', | ||
range: { start: { line: 1, character: 0 }, end: { line: 1, character: 1 } }, | ||
severity: 0, | ||
source: 'c.lu', | ||
}, | ||
{ | ||
message: 'file empty', | ||
range: { start: { line: 2, character: 0 }, end: { line: 2, character: 1 } }, | ||
severity: 1, | ||
source: 'd.lu', | ||
}, | ||
]; | ||
|
||
const diagnostics1 = [ | ||
{ | ||
message: 'file empty', | ||
range: { start: { line: 2, character: 0 }, end: { line: 2, character: 1 } }, | ||
severity: 1, | ||
source: 'd.lu', | ||
}, | ||
]; | ||
|
||
describe('diagnostic utils', () => { | ||
it('should check if the diagnostics have errors', () => { | ||
expect(isValid(diagnostics)).toBe(false); | ||
expect(isValid(diagnostics1)).toBe(true); | ||
}); | ||
it('should find all errors', () => { | ||
expect(findErrors(diagnostics).length).toBe(3); | ||
expect(findErrors(diagnostics1).length).toBe(0); | ||
}); | ||
it('should create a message for single diagnostic', () => { | ||
expect(createSingleMessage(diagnostics[0])).toContain('line 15:0 - line 15:1'); | ||
expect(createSingleMessage(diagnostics[1])).toContain('line 0:0 - line 0:1'); | ||
}); | ||
it('should combine all error message', () => { | ||
const result = combineMessage(diagnostics); | ||
expect(result).toContain('line 15:0 - line 15:1'); | ||
expect(result).toContain('line 0:0 - line 0:1'); | ||
expect(result).toContain('line 1:0 - line 1:1'); | ||
expect(result).toContain('line 2:0 - line 2:1'); | ||
}); | ||
}); |
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
Oops, something went wrong.