mirror of
https://gitee.com/openharmony/napi_generator
synced 2024-11-23 16:30:17 +00:00
commit
bf471c967e
@ -62,6 +62,10 @@ describe('Any fun1', function () {
|
|||||||
let ret = test.fun1('guding', 'aaa');
|
let ret = test.fun1('guding', 'aaa');
|
||||||
assert.strictEqual(ret, 0);
|
assert.strictEqual(ret, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Any fun1 array map part', function () {
|
||||||
it('test fun1 Array<map<string>>', function () {
|
it('test fun1 Array<map<string>>', function () {
|
||||||
let ret = test.fun1([{ "test": "okay", "test1": "res" }, { "test2": "okay2", "test3": "res3" }], 'aaa');
|
let ret = test.fun1([{ "test": "okay", "test1": "res" }, { "test2": "okay2", "test3": "res3" }], 'aaa');
|
||||||
assert.strictEqual(ret, 0);
|
assert.strictEqual(ret, 0);
|
||||||
|
@ -50,66 +50,61 @@ describe('string case', function () {
|
|||||||
assert.strictEqual(err.code, 0)
|
assert.strictEqual(err.code, 0)
|
||||||
assert.deepStrictEqual(ret, '')
|
assert.deepStrictEqual(ret, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
function def1(ret) {
|
function def1(ret) {
|
||||||
assert.deepStrictEqual(ret, '');
|
assert.deepStrictEqual(ret, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// function fun6(v1: string, callback: AsyncCallback<string>): void;
|
// function fun6(v1: string, callback: AsyncCallback<string>): void;
|
||||||
it('test fun6_callback', function () {
|
it('test fun6_callback', function () {
|
||||||
test.fun6('15', asynFun1);
|
test.fun6('15', asynFun1);
|
||||||
test.fun6('15').then(def1);
|
test.fun6('15').then(def1);
|
||||||
});
|
});
|
||||||
|
|
||||||
// function fun6(v1: string): Promise<string>;
|
// function fun6(v1: string): Promise<string>;
|
||||||
it('test fun6_promise', function () {
|
it('test fun6_promise', function () {
|
||||||
let promiseObj = test.fun6('15');
|
let promiseObj = test.fun6('15');
|
||||||
promiseObj.then(ret => { def1(ret) });
|
promiseObj.then(ret => { def1(ret) });
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('string case part2', function () {
|
||||||
function asynFun2(err, ret) {
|
function asynFun2(err, ret) {
|
||||||
assert.deepStrictEqual(err.code, 0)
|
assert.deepStrictEqual(err.code, 0)
|
||||||
assert.deepStrictEqual(ret, [])
|
assert.deepStrictEqual(ret, [])
|
||||||
}
|
}
|
||||||
|
|
||||||
function def2(ret) {
|
function def2(ret) {
|
||||||
assert.deepStrictEqual(ret, []);
|
assert.deepStrictEqual(ret, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
// function fun7(v: string, v1: AsyncCallback<Array<string>>): void;
|
// function fun7(v: string, v1: AsyncCallback<Array<string>>): void;
|
||||||
it('test fun7_callback', function () {
|
it('test fun7_callback', function () {
|
||||||
test.fun7('15', asynFun2);
|
test.fun7('15', asynFun2);
|
||||||
test.fun7('15').then(def2);
|
test.fun7('15').then(def2);
|
||||||
});
|
});
|
||||||
|
|
||||||
// function fun7(v: string): Promise<Array<string>>;
|
// function fun7(v: string): Promise<Array<string>>;
|
||||||
it('test fun7_promise', function () {
|
it('test fun7_promise', function () {
|
||||||
let promiseObj = test.fun7('15');
|
let promiseObj = test.fun7('15');
|
||||||
promiseObj.then(ret => { def2(ret) });
|
promiseObj.then(ret => { def2(ret) });
|
||||||
});
|
});
|
||||||
|
|
||||||
// define callback for fun8
|
// define callback for fun8
|
||||||
function asynFun8(err, ret) {
|
function asynFun8(err, ret) {
|
||||||
assert.deepStrictEqual(err.code, 0)
|
assert.deepStrictEqual(err.code, 0)
|
||||||
assert.deepStrictEqual(ret, [])
|
assert.deepStrictEqual(ret, [])
|
||||||
}
|
}
|
||||||
|
|
||||||
function def8(ret) {
|
function def8(ret) {
|
||||||
assert.deepStrictEqual(ret, []);
|
assert.deepStrictEqual(ret, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
// function fun8(v1: string, callback: AsyncCallback<string[]>): void;
|
// function fun8(v1: string, callback: AsyncCallback<string[]>): void;
|
||||||
it('test fun8_AsyncCallback', function () {
|
it('test fun8_AsyncCallback', function () {
|
||||||
test.fun8('funTest', asynFun8);
|
test.fun8('funTest', asynFun8);
|
||||||
test.fun8('funTest').then(def8);
|
test.fun8('funTest').then(def8);
|
||||||
});
|
});
|
||||||
|
|
||||||
// function fun8(v1: string): Promise<string[]>;
|
// function fun8(v1: string): Promise<string[]>;
|
||||||
it('test fun8_promise', function () {
|
it('test fun8_promise', function () {
|
||||||
let promiseObj = test.fun8('funTest');
|
let promiseObj = test.fun8('funTest');
|
||||||
promiseObj.then(ret => { def8(ret) });
|
promiseObj.then(ret => { def8(ret) });
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('string case part3', function () {
|
||||||
|
|
||||||
function cb1(ret) {
|
function cb1(ret) {
|
||||||
assert.deepStrictEqual(ret, '')
|
assert.deepStrictEqual(ret, '')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user