Skip to content

Commit 8edc46c

Browse files
committed
Don't assume that file names do not contain colons when translating compiler output from 0.4.10
1 parent 8920105 commit 8edc46c

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

test/compiler.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,31 @@ function runTests (solc, versionText) {
757757
}
758758
st.end();
759759
});
760+
761+
t.test('compiling standard JSON (file names containing symbols)', function (st) {
762+
var input = {
763+
'language': 'Solidity',
764+
'settings': {
765+
'outputSelection': {
766+
'*': {
767+
'*': ['evm.bytecode']
768+
}
769+
}
770+
},
771+
'sources': {
772+
'!@#$%^&*()_+-=[]{}\\|"\';:~`<>,.?/': {
773+
'content': 'contract C {}'
774+
}
775+
}
776+
};
777+
778+
var output = JSON.parse(solc.compile(JSON.stringify(input)));
779+
st.ok(expectNoError(output));
780+
var C = getBytecodeStandard(output, '!@#$%^&*()_+-=[]{}\\|"\';:~`<>,.?/', 'C');
781+
st.ok(typeof C === 'string');
782+
st.ok(C.length > 0);
783+
st.end();
784+
});
760785
});
761786
});
762787

@@ -810,6 +835,7 @@ if (!noRemoteVersions) {
810835
'v0.2.1+commit.91a6b35',
811836
'v0.3.6+commit.3fc68da',
812837
'v0.4.0+commit.acd334c9',
838+
'v0.4.10+commit.f0d539ae',
813839
'v0.4.11+commit.68ef5810',
814840
'v0.4.12+commit.194ff033',
815841
'v0.4.26+commit.4563c3fc'

translate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function translateJsonCompilerOutput (output, libraries) {
7878
ret['contracts'] = {};
7979
for (var contract in output['contracts']) {
8080
// Split name first, can be `contract`, `:contract` or `filename:contract`
81-
var tmp = contract.match(/^(([^:]*):)?([^:]+)$/);
81+
var tmp = contract.match(/^((.*):)?([^:]+)$/);
8282
if (tmp.length !== 4) {
8383
// Force abort
8484
return null;

0 commit comments

Comments
 (0)