# compiler unit testing
**The compiler unit testing for ace2.0.**
## Usage
Here are simplified instructions of how to get started. The following commands work both on **Windows** and **Linux** platforms.
### 1. Install
First, enter the root directory of the compiler:
```
$ cd compiler/
```
And then install the npm dependencies(You must have node&npm installed):
```
$ npm install
```
**Note**: If some errors occur, delete the generated package `node_modules`, config npm proxy and run `npm install` again.
```
npm config set proxy http://username:password@server:port
npm confit set https-proxy http://username:password@server:port
```
### 2. Quick Start
First, create a new test file or directory in `compiler/test`.
Write source code in variable 'source', and write expected code in variable 'expectResult':
```
// source code
export const source: string = `...`
// expected code
export const expectResult: string = `...`
```
In the root directory of `compiler/`:
```
$ npm run test
```
All files in the `compiler/test` will be tested.
### 3. Example
1. Create a new test directory `foo` in `compiler`.
2. Create a new test file `bar.ts` in `compiler/foo`.
3. In the file `bar.ts`, write the following lines:
```
export const source: string = `
struct MyComponent {
build() {
}
}`
export const expectResult: string =
`class MyComponent {
build() {
}
}
`
```
4. In the root directory of `compiler/`:
```
$ npm run test
```
5. All files in the `compiler/test` will be tested. The output is like the following lines:
```
✓ bar
1 passing (1ms)
```
**Note**: If the actual building result is different from the expected result and the output is like the following lines, you should check the error:
```
1) bar
0 passing (1ms)
1 failing
1) compiler
bar:
AssertionError: expected 'class MyComponent {\n build() {\n }\n}\n' to deeply equal 'class MyComponent {\n build() {\n \n}\n'
+ expected - actual
class MyComponent {
build() {
- }
+
}
```
没有合适的资源?快使用搜索试试~ 我知道了~
developtools-ace-ets2bundle提供声明式范式的语法编译转换,语法验证,丰富友好的语法报错提示能力
共502个文件
ts:255个
json:163个
ets:49个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 48 浏览量
2023-11-17
11:46:21
上传
评论
收藏 797KB ZIP 举报
温馨提示
提供声明式范式的语法编译转换,语法验证,丰富友好的语法报错提示能力。
资源推荐
资源详情
资源评论
收起资源包目录
developtools-ace-ets2bundle提供声明式范式的语法编译转换,语法验证,丰富友好的语法报错提示能力 (502个子文件)
.eslintrc 3KB
showcaseCovid19.ets 237KB
willdo.ets 6KB
stacktestsuite.ets 4KB
simpleText.ets 4KB
stateStateBindingProp.ets 4KB
NamespaceComponent.ets 3KB
ExportComponent.ets 3KB
LinkComponent.ets 3KB
componentGridTest.ets 3KB
stateArrayReverseCustomView.ets 3KB
componentListTest.ets 2KB
stateArrayReverse.ets 2KB
forEachSimpleModel.ets 2KB
forEachComplexModel.ets 2KB
propSimpleModel.ets 2KB
stateComplexType.ets 2KB
DefaultComponent.ets 2KB
AMDComponent.ets 1KB
onclicktest.ets 1KB
home_preview.ets 1KB
linkArrayModel.ets 1KB
link-01.ets 1KB
linkPropCombo.ets 1KB
index.ets 1KB
BaseComponent.ets 1KB
home.ets 1KB
linkSimpleModel.ets 1KB
DivideComponent.ets 1KB
import-api-01.ets 1KB
image.ets 1021B
TestComponent.ets 995B
constructor-01.ets 964B
component-01.ets 961B
new-04.ets 912B
new-03.ets 908B
new-02.ets 898B
new-01.ets 890B
new-0101.ets 890B
[email protected] 838B
constructor-03.ets 824B
constructor-02.ets 824B
ImportNestAll.ets 772B
app.ets 768B
ImportNest.ets 748B
ExportNest.ets 715B
struct-01.ets 671B
ExportStarComponent.ets 664B
struct-02.ets 653B
.gitignore 221B
BUILD.gn 9KB
codegen_ets.js 267KB
main.js 33KB
webpack.config.js 14KB
build_pipe_server.js 12KB
build_declarations_file.js 10KB
test.js 6KB
rollup.config.js 3KB
compile_plugin.js 2KB
link-01-expected.js 2KB
npm-install.js 1KB
uglify-source.js 1KB
constructor-01-expected.js 1KB
new-03-expected.js 1KB
new-04-expected.js 1KB
new-01-expected.js 991B
new-02-expected.js 991B
constructor-02-expected.js 974B
constructor-03-expected.js 970B
babel.config.js 964B
component-01-expected.js 957B
struct-01-expected.js 729B
struct-02-expected.js 651B
package-lock.json 197KB
tsconfig.json 20KB
tsconfig.esm.json 20KB
error.json 10KB
package.json 2KB
common_attrs.json 2KB
bundle.json 1KB
web.json 1KB
manifest.json 954B
common_attrs.json 899B
textinput.json 639B
grid.json 536B
list.json 505B
textarea.json 500B
shape.json 378B
shape.json 374B
location_button.json 357B
paste_button.json 354B
save_button.json 353B
navigation.json 343B
search.json 341B
alphabet_indexer.json 335B
water_flow.json 323B
text.json 319B
list.json 317B
image.json 308B
共 502 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6718
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功