Skip to content

Commit eee04d7

Browse files
arthcpaxic
authored andcommitted
Add test to link when colon is not present in library name
1 parent 720edca commit eee04d7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/linker.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,15 @@ tape('Linking', function (t) {
155155
st.equal(bytecode, '6060604052341561000000000000000000000000000000000000012345666606060606060');
156156
st.end();
157157
});
158+
159+
t.test('link properly when library doesn\'t have colon in name', function (st) {
160+
/*
161+
'lib.sol': 'library L { function f() public returns (uint) { return 7; } }',
162+
'cont.sol': 'import "lib.sol"; contract x { function g() public { L.f(); } }'
163+
*/
164+
var bytecode = '608060405234801561001057600080fd5b5061011f806100206000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063e2179b8e146044575b600080fd5b348015604f57600080fd5b5060566058565b005b73__libName_______________________________6326121ff06040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801560b757600080fd5b505af415801560ca573d6000803e3d6000fd5b505050506040513d602081101560df57600080fd5b8101908080519060200190929190505050505600a165627a7a72305820ea2f6353179c181d7162544d637b7fe2d9e8da9803a0e2d9eafc2188d1d59ee30029';
165+
bytecode = linker.linkBytecode(bytecode, { 'libName': '0x123456' });
166+
st.ok(bytecode.indexOf('_') < 0);
167+
st.end();
168+
});
158169
});

0 commit comments

Comments
 (0)