@@ -48,7 +48,7 @@ tape('Version and license', function (t) {
48
48
49
49
tape ( 'Compilation' , function ( t ) {
50
50
t . test ( 'single files can be compiled' , function ( st ) {
51
- var output = solc . compile ( 'contract x { function g() {} }' ) ;
51
+ var output = solc . compile ( 'contract x { function g() public {} }' ) ;
52
52
st . ok ( 'contracts' in output ) ;
53
53
var bytecode = getBytecode ( output , '' , 'x' ) ;
54
54
st . ok ( bytecode ) ;
@@ -90,8 +90,8 @@ tape('Compilation', function (t) {
90
90
}
91
91
92
92
var input = {
93
- 'lib.sol' : 'library L { function f() returns (uint) { return 7; } }' ,
94
- 'cont.sol' : 'import "lib.sol"; contract x { function g() { L.f(); } }'
93
+ 'lib.sol' : 'library L { function f() public returns (uint) { return 7; } }' ,
94
+ 'cont.sol' : 'import "lib.sol"; contract x { function g() public { L.f(); } }'
95
95
} ;
96
96
var output = solc . compile ( { sources : input } ) ;
97
97
var x = getBytecode ( output , 'cont.sol' , 'x' ) ;
@@ -111,11 +111,11 @@ tape('Compilation', function (t) {
111
111
}
112
112
113
113
var input = {
114
- 'cont.sol' : 'import "lib.sol"; contract x { function g() { L.f(); } }'
114
+ 'cont.sol' : 'import "lib.sol"; contract x { function g() public { L.f(); } }'
115
115
} ;
116
116
function findImports ( path ) {
117
117
if ( path === 'lib.sol' ) {
118
- return { contents : 'library L { function f() returns (uint) { return 7; } }' } ;
118
+ return { contents : 'library L { function f() public returns (uint) { return 7; } }' } ;
119
119
} else {
120
120
return { error : 'File not found' } ;
121
121
}
@@ -138,7 +138,7 @@ tape('Compilation', function (t) {
138
138
}
139
139
140
140
var input = {
141
- 'cont.sol' : 'import "lib.sol"; contract x { function g() { L.f(); } }'
141
+ 'cont.sol' : 'import "lib.sol"; contract x { function g() public { L.f(); } }'
142
142
} ;
143
143
function findImports ( path ) {
144
144
return { error : 'File not found' } ;
@@ -167,7 +167,7 @@ tape('Compilation', function (t) {
167
167
}
168
168
169
169
var input = {
170
- 'cont.sol' : 'import "lib.sol"; contract x { function g() { L.f(); } }'
170
+ 'cont.sol' : 'import "lib.sol"; contract x { function g() public { L.f(); } }'
171
171
} ;
172
172
function findImports ( path ) {
173
173
throw new Error ( 'Could not implement this interface properly...' ) ;
@@ -186,7 +186,7 @@ tape('Compilation', function (t) {
186
186
}
187
187
188
188
var input = {
189
- 'cont.sol' : 'import "lib.sol"; contract x { function g() { L.f(); } }'
189
+ 'cont.sol' : 'import "lib.sol"; contract x { function g() public { L.f(); } }'
190
190
} ;
191
191
st . throws ( function ( ) {
192
192
solc . compile ( { sources : input } , 0 , "this isn't a callback" ) ;
@@ -202,7 +202,7 @@ tape('Compilation', function (t) {
202
202
}
203
203
204
204
var input = {
205
- 'cont.sol' : 'import "lib.sol"; contract x { function g() { L.f(); } }'
205
+ 'cont.sol' : 'import "lib.sol"; contract x { function g() public { L.f(); } }'
206
206
} ;
207
207
var output = solc . compile ( { sources : input } , 0 ) ;
208
208
st . plan ( 3 ) ;
@@ -238,10 +238,10 @@ tape('Compilation', function (t) {
238
238
} ,
239
239
'sources' : {
240
240
'lib.sol' : {
241
- 'content' : 'library L { function f() returns (uint) { return 7; } }'
241
+ 'content' : 'library L { function f() public returns (uint) { return 7; } }'
242
242
} ,
243
243
'cont.sol' : {
244
- 'content' : 'import "lib.sol"; contract x { function g() { L.f(); } }'
244
+ 'content' : 'import "lib.sol"; contract x { function g() public { L.f(); } }'
245
245
}
246
246
}
247
247
} ;
@@ -311,14 +311,14 @@ tape('Compilation', function (t) {
311
311
} ,
312
312
'sources' : {
313
313
'cont.sol' : {
314
- 'content' : 'import "lib.sol"; contract x { function g() { L.f(); } }'
314
+ 'content' : 'import "lib.sol"; contract x { function g() public { L.f(); } }'
315
315
}
316
316
}
317
317
} ;
318
318
319
319
function findImports ( path ) {
320
320
if ( path === 'lib.sol' ) {
321
- return { contents : 'library L { function f() returns (uint) { return 7; } }' } ;
321
+ return { contents : 'library L { function f() public returns (uint) { return 7; } }' } ;
322
322
} else {
323
323
return { error : 'File not found' } ;
324
324
}
@@ -357,10 +357,10 @@ tape('Compilation', function (t) {
357
357
} ,
358
358
'sources' : {
359
359
'lib.sol' : {
360
- 'content' : 'library L { function f() returns (uint) { return 7; } }'
360
+ 'content' : 'library L { function f() public returns (uint) { return 7; } }'
361
361
} ,
362
362
'cont.sol' : {
363
- 'content' : 'import "lib.sol"; contract x { function g() { L.f(); } }'
363
+ 'content' : 'import "lib.sol"; contract x { function g() public { L.f(); } }'
364
364
}
365
365
}
366
366
} ;
@@ -400,10 +400,10 @@ tape('Compilation', function (t) {
400
400
} ,
401
401
'sources' : {
402
402
'lib.sol' : {
403
- 'content' : 'library L { function f() returns (uint) { return 7; } }'
403
+ 'content' : 'library L { function f() public returns (uint) { return 7; } }'
404
404
} ,
405
405
'cont.sol' : {
406
- 'content' : 'import "lib.sol"; contract x { function g() { L.f(); } }'
406
+ 'content' : 'import "lib.sol"; contract x { function g() public { L.f(); } }'
407
407
}
408
408
}
409
409
} ;
@@ -426,7 +426,7 @@ tape('Loading Legacy Versions', function (t) {
426
426
st . plan ( 3 ) ;
427
427
solc . loadRemoteVersion ( 'latest' , function ( err , solcSnapshot ) {
428
428
st . notOk ( err ) ;
429
- var output = solcSnapshot . compile ( 'contract x { function g() {} }' ) ;
429
+ var output = solcSnapshot . compile ( 'contract x { function g() public {} }' ) ;
430
430
st . ok ( ':x' in output . contracts ) ;
431
431
st . ok ( output . contracts [ ':x' ] . bytecode . length > 0 ) ;
432
432
} ) ;
@@ -444,8 +444,8 @@ tape('Linking', function (t) {
444
444
445
445
t . test ( 'link properly' , function ( st ) {
446
446
var input = {
447
- 'lib.sol' : 'library L { function f() returns (uint) { return 7; } }' ,
448
- 'cont.sol' : 'import "lib.sol"; contract x { function g() { L.f(); } }'
447
+ 'lib.sol' : 'library L { function f() public returns (uint) { return 7; } }' ,
448
+ 'cont.sol' : 'import "lib.sol"; contract x { function g() public { L.f(); } }'
449
449
} ;
450
450
var output = solc . compile ( { sources : input } ) ;
451
451
var bytecode = getBytecode ( output , 'cont.sol' , 'x' ) ;
@@ -458,8 +458,8 @@ tape('Linking', function (t) {
458
458
459
459
t . test ( 'link properly with two-level configuration (from standard JSON)' , function ( st ) {
460
460
var input = {
461
- 'lib.sol' : 'library L { function f() returns (uint) { return 7; } }' ,
462
- 'cont.sol' : 'import "lib.sol"; contract x { function g() { L.f(); } }'
461
+ 'lib.sol' : 'library L { function f() public returns (uint) { return 7; } }' ,
462
+ 'cont.sol' : 'import "lib.sol"; contract x { function g() public { L.f(); } }'
463
463
} ;
464
464
var output = solc . compile ( { sources : input } ) ;
465
465
var bytecode = getBytecode ( output , 'cont.sol' , 'x' ) ;
@@ -472,8 +472,8 @@ tape('Linking', function (t) {
472
472
473
473
t . test ( 'linker to fail with missing library' , function ( st ) {
474
474
var input = {
475
- 'lib.sol' : 'library L { function f() returns (uint) { return 7; } }' ,
476
- 'cont.sol' : 'import "lib.sol"; contract x { function g() { L.f(); } }'
475
+ 'lib.sol' : 'library L { function f() public returns (uint) { return 7; } }' ,
476
+ 'cont.sol' : 'import "lib.sol"; contract x { function g() public { L.f(); } }'
477
477
} ;
478
478
var output = solc . compile ( { sources : input } ) ;
479
479
var bytecode = getBytecode ( output , 'cont.sol' , 'x' ) ;
@@ -486,8 +486,8 @@ tape('Linking', function (t) {
486
486
487
487
t . test ( 'linker to fail with invalid address' , function ( st ) {
488
488
var input = {
489
- 'lib.sol' : 'library L { function f() returns (uint) { return 7; } }' ,
490
- 'cont.sol' : 'import "lib.sol"; contract x { function g() { L.f(); } }'
489
+ 'lib.sol' : 'library L { function f() public returns (uint) { return 7; } }' ,
490
+ 'cont.sol' : 'import "lib.sol"; contract x { function g() public { L.f(); } }'
491
491
} ;
492
492
var output = solc . compile ( { sources : input } ) ;
493
493
var bytecode = getBytecode ( output , 'cont.sol' , 'x' ) ;
@@ -501,8 +501,8 @@ tape('Linking', function (t) {
501
501
502
502
t . test ( 'linker properly with truncated library name' , function ( st ) {
503
503
var input = {
504
- 'lib.sol' : 'library L1234567890123456789012345678901234567890 { function f() returns (uint) { return 7; } }' ,
505
- 'cont.sol' : 'import "lib.sol"; contract x { function g() { L1234567890123456789012345678901234567890.f(); } }'
504
+ 'lib.sol' : 'library L1234567890123456789012345678901234567890 { function f() public returns (uint) { return 7; } }' ,
505
+ 'cont.sol' : 'import "lib.sol"; contract x { function g() public { L1234567890123456789012345678901234567890.f(); } }'
506
506
} ;
507
507
var output = solc . compile ( { sources : input } ) ;
508
508
var bytecode = getBytecode ( output , 'cont.sol' , 'x' ) ;
0 commit comments