diff options
author | F. Eugene Aumson <gene@aumson.org> | 2018-09-14 02:25:54 +0800 |
---|---|---|
committer | F. Eugene Aumson <gene@aumson.org> | 2018-09-18 07:31:37 +0800 |
commit | 4ade674ada7596f1a7c5d0113815c5964e82db0f (patch) | |
tree | 0089c955d866070a7f7e393032dba30d6673ddc8 /packages/sol-doc/test/solidity_doc_generator_test.ts | |
parent | 401ef2edef50a73ec387d95ac9998f9badb4b34a (diff) | |
download | dexon-0x-contracts-4ade674ada7596f1a7c5d0113815c5964e82db0f.tar dexon-0x-contracts-4ade674ada7596f1a7c5d0113815c5964e82db0f.tar.gz dexon-0x-contracts-4ade674ada7596f1a7c5d0113815c5964e82db0f.tar.bz2 dexon-0x-contracts-4ade674ada7596f1a7c5d0113815c5964e82db0f.tar.lz dexon-0x-contracts-4ade674ada7596f1a7c5d0113815c5964e82db0f.tar.xz dexon-0x-contracts-4ade674ada7596f1a7c5d0113815c5964e82db0f.tar.zst dexon-0x-contracts-4ade674ada7596f1a7c5d0113815c5964e82db0f.zip |
test multiple return values from a solidity method
Diffstat (limited to 'packages/sol-doc/test/solidity_doc_generator_test.ts')
-rw-r--r-- | packages/sol-doc/test/solidity_doc_generator_test.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/sol-doc/test/solidity_doc_generator_test.ts b/packages/sol-doc/test/solidity_doc_generator_test.ts index 896690ce6..5004b1a90 100644 --- a/packages/sol-doc/test/solidity_doc_generator_test.ts +++ b/packages/sol-doc/test/solidity_doc_generator_test.ts @@ -153,6 +153,26 @@ describe('#SolidityDocGenerator', () => { expect(methodDoc.comment).to.equal('methodWithSolhintDirective @dev'); }); }); + it('should document a method that returns multiple values', async () => { + const doc = await generateSolDocAsync(`${__dirname}/../../test/fixtures/contracts`, ['MultipleReturnValues']); + expect(doc.MultipleReturnValues).to.not.be.undefined(); + expect(doc.MultipleReturnValues.methods).to.not.be.undefined(); + let methodWithMultipleReturnValues: SolidityMethod | undefined; + for (const method of doc.MultipleReturnValues.methods) { + if (method.name === 'methodWithMultipleReturnValues') { + methodWithMultipleReturnValues = method; + } + } + if (_.isUndefined(methodWithMultipleReturnValues)) { + throw new Error('method should not be undefined'); + } + const returnType = methodWithMultipleReturnValues.returnType; + expect(returnType.typeDocType).to.equal('tuple'); + if (_.isUndefined(returnType.tupleElements)) { + throw new Error('returnType.tupleElements should not be undefined'); + } + expect(returnType.tupleElements.length).to.equal(2); + }); }); function verifyTokenTransferProxyABIIsDocumented(doc: DocAgnosticFormat, contractName: string): void { |