Skip to content

Commit 87b66e6

Browse files
authored
Merge pull request #240 from bit-shift/visibilitySpecifier
Adds visibility specifier
2 parents d2ed4f1 + 38c529d commit 87b66e6

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

test/package.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ tape('Version and license', function (t) {
4848

4949
tape('Compilation', function (t) {
5050
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 {} }');
5252
st.ok('contracts' in output);
5353
var bytecode = getBytecode(output, '', 'x');
5454
st.ok(bytecode);
@@ -90,8 +90,8 @@ tape('Compilation', function (t) {
9090
}
9191

9292
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(); } }'
9595
};
9696
var output = solc.compile({sources: input});
9797
var x = getBytecode(output, 'cont.sol', 'x');
@@ -111,11 +111,11 @@ tape('Compilation', function (t) {
111111
}
112112

113113
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(); } }'
115115
};
116116
function findImports (path) {
117117
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; } }' };
119119
} else {
120120
return { error: 'File not found' };
121121
}
@@ -138,7 +138,7 @@ tape('Compilation', function (t) {
138138
}
139139

140140
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(); } }'
142142
};
143143
function findImports (path) {
144144
return { error: 'File not found' };
@@ -167,7 +167,7 @@ tape('Compilation', function (t) {
167167
}
168168

169169
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(); } }'
171171
};
172172
function findImports (path) {
173173
throw new Error('Could not implement this interface properly...');
@@ -186,7 +186,7 @@ tape('Compilation', function (t) {
186186
}
187187

188188
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(); } }'
190190
};
191191
st.throws(function () {
192192
solc.compile({sources: input}, 0, "this isn't a callback");
@@ -202,7 +202,7 @@ tape('Compilation', function (t) {
202202
}
203203

204204
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(); } }'
206206
};
207207
var output = solc.compile({sources: input}, 0);
208208
st.plan(3);
@@ -238,10 +238,10 @@ tape('Compilation', function (t) {
238238
},
239239
'sources': {
240240
'lib.sol': {
241-
'content': 'library L { function f() returns (uint) { return 7; } }'
241+
'content': 'library L { function f() public returns (uint) { return 7; } }'
242242
},
243243
'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(); } }'
245245
}
246246
}
247247
};
@@ -311,14 +311,14 @@ tape('Compilation', function (t) {
311311
},
312312
'sources': {
313313
'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(); } }'
315315
}
316316
}
317317
};
318318

319319
function findImports (path) {
320320
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; } }' };
322322
} else {
323323
return { error: 'File not found' };
324324
}
@@ -357,10 +357,10 @@ tape('Compilation', function (t) {
357357
},
358358
'sources': {
359359
'lib.sol': {
360-
'content': 'library L { function f() returns (uint) { return 7; } }'
360+
'content': 'library L { function f() public returns (uint) { return 7; } }'
361361
},
362362
'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(); } }'
364364
}
365365
}
366366
};
@@ -400,10 +400,10 @@ tape('Compilation', function (t) {
400400
},
401401
'sources': {
402402
'lib.sol': {
403-
'content': 'library L { function f() returns (uint) { return 7; } }'
403+
'content': 'library L { function f() public returns (uint) { return 7; } }'
404404
},
405405
'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(); } }'
407407
}
408408
}
409409
};
@@ -426,7 +426,7 @@ tape('Loading Legacy Versions', function (t) {
426426
st.plan(3);
427427
solc.loadRemoteVersion('latest', function (err, solcSnapshot) {
428428
st.notOk(err);
429-
var output = solcSnapshot.compile('contract x { function g() {} }');
429+
var output = solcSnapshot.compile('contract x { function g() public {} }');
430430
st.ok(':x' in output.contracts);
431431
st.ok(output.contracts[':x'].bytecode.length > 0);
432432
});
@@ -444,8 +444,8 @@ tape('Linking', function (t) {
444444

445445
t.test('link properly', function (st) {
446446
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(); } }'
449449
};
450450
var output = solc.compile({sources: input});
451451
var bytecode = getBytecode(output, 'cont.sol', 'x');
@@ -458,8 +458,8 @@ tape('Linking', function (t) {
458458

459459
t.test('link properly with two-level configuration (from standard JSON)', function (st) {
460460
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(); } }'
463463
};
464464
var output = solc.compile({sources: input});
465465
var bytecode = getBytecode(output, 'cont.sol', 'x');
@@ -472,8 +472,8 @@ tape('Linking', function (t) {
472472

473473
t.test('linker to fail with missing library', function (st) {
474474
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(); } }'
477477
};
478478
var output = solc.compile({sources: input});
479479
var bytecode = getBytecode(output, 'cont.sol', 'x');
@@ -486,8 +486,8 @@ tape('Linking', function (t) {
486486

487487
t.test('linker to fail with invalid address', function (st) {
488488
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(); } }'
491491
};
492492
var output = solc.compile({sources: input});
493493
var bytecode = getBytecode(output, 'cont.sol', 'x');
@@ -501,8 +501,8 @@ tape('Linking', function (t) {
501501

502502
t.test('linker properly with truncated library name', function (st) {
503503
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(); } }'
506506
};
507507
var output = solc.compile({sources: input});
508508
var bytecode = getBytecode(output, 'cont.sol', 'x');

0 commit comments

Comments
 (0)