File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -396,6 +396,48 @@ tape('Compilation', function (t) {
396
396
st . end ( ) ;
397
397
} ) ;
398
398
399
+ t . test ( 'compiling standard JSON (with imports)' , function ( st ) {
400
+ // <0.1.6 doesn't have this
401
+ if ( ! solc . features . multipleInputs ) {
402
+ st . skip ( 'Not supported by solc' ) ;
403
+ st . end ( ) ;
404
+ return ;
405
+ }
406
+
407
+ var input = {
408
+ 'language' : 'Solidity' ,
409
+ 'settings' : {
410
+ 'outputSelection' : {
411
+ '*' : {
412
+ '*' : [ 'evm.bytecode' ]
413
+ }
414
+ }
415
+ } ,
416
+ 'sources' : {
417
+ 'cont.sol' : {
418
+ 'content' : 'import "lib.sol"; contract x { function g() public { L.f(); } }'
419
+ }
420
+ }
421
+ } ;
422
+
423
+ function findImports ( path ) {
424
+ if ( path === 'lib.sol' ) {
425
+ return { contents : 'library L { function f() public returns (uint) { return 7; } }' } ;
426
+ } else {
427
+ return { error : 'File not found' } ;
428
+ }
429
+ }
430
+
431
+ var output = JSON . parse ( solc . compile ( JSON . stringify ( input ) , findImports ) ) ;
432
+ var x = getBytecodeStandard ( output , 'cont.sol' , 'x' ) ;
433
+ st . ok ( x ) ;
434
+ st . ok ( x . length > 0 ) ;
435
+ var L = getBytecodeStandard ( output , 'lib.sol' , 'L' ) ;
436
+ st . ok ( L ) ;
437
+ st . ok ( L . length > 0 ) ;
438
+ st . end ( ) ;
439
+ } ) ;
440
+
399
441
t . test ( 'compiling standard JSON (using libraries)' , function ( st ) {
400
442
// <0.1.6 doesn't have this
401
443
if ( ! solc . features . multipleInputs ) {
You can’t perform that action at this time.
0 commit comments