-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from Jeff-Tian/fix/utf-8
feat: save file with utf-8 encoding to support CJK characters
- Loading branch information
Showing
8 changed files
with
82 additions
and
7 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 |
---|---|---|
|
@@ -42,3 +42,5 @@ jspm_packages | |
|
||
# Optional REPL history | ||
.node_repl_history | ||
.idea | ||
output.puml |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
|
||
declare module 'plantuml-encoder' { | ||
export function encode(text: string): string; | ||
} | ||
} |
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,10 @@ | ||
namespace CJK { | ||
/** | ||
* ChineseCharacters | ||
* | ||
* Some classes might contains some Chinese characters | ||
*/ | ||
class ChineseCharacters { | ||
public 你好: string = ''; | ||
} | ||
} |
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,29 @@ | ||
import {exec} from 'child_process'; | ||
import * as fs from 'fs'; | ||
import * as os from 'os'; | ||
import DoneCallback = jest.DoneCallback; | ||
|
||
jest.setTimeout(10000); | ||
|
||
describe('Parse codes that contains CJK characters', () => { | ||
|
||
it('generate PlantUML for classes that contains CJK characters', (done: DoneCallback) => { | ||
// tslint:disable-next-line:max-line-length | ||
exec('ts-node --project ./tsconfig.json ./src/index.ts -i ./test/CJK/CJK.ts --output ./output.puml', () => { | ||
const fileContent: string = fs.readFileSync('./output.puml', 'utf-8'); | ||
|
||
expect(fileContent) | ||
.toEqual( | ||
['@startuml', | ||
'namespace CJK {', | ||
' class ChineseCharacters {', | ||
' +你好: string', | ||
' }', | ||
'}', | ||
'@enduml'].join(os.EOL) | ||
); | ||
|
||
done(); | ||
}); | ||
}); | ||
}); |
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