Skip to content

Commit 6551c64

Browse files
committed
remove legacy fallback code and add tests for isNil
1 parent 6667eb1 commit 6551c64

File tree

5 files changed

+26
-21
lines changed

5 files changed

+26
-21
lines changed

bindings/core.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ function bindAlloc(solJson: SolJson) {
4545
null,
4646
)
4747

48-
// the fallback malloc is not a cwrap function and should just be returned
49-
// directly in-case the alloc binding could not happen.
50-
if (isNil(allocBinding)) {
51-
return solJson._malloc
52-
}
53-
5448
return allocBinding
5549
}
5650

common.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1 @@
1-
export const formatFatalError = (message: string) =>
2-
JSON.stringify({
3-
errors: [
4-
{
5-
type: 'JSONError',
6-
component: 'solcjs',
7-
severity: 'error',
8-
message: message,
9-
formattedMessage: 'Error: ' + message,
10-
},
11-
],
12-
})
13-
141
export const isNil = (value: unknown): value is null => value == null

common_test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { isNil } from './common.ts'
2+
import { expect } from '@std/expect'
3+
import { describe, it } from '@std/testing/bdd'
4+
5+
describe('common.ts', () => {
6+
it('isNil', () => {
7+
expect(isNil(null)).toBe(true)
8+
expect(isNil(undefined)).toBe(true)
9+
expect(isNil(0)).toBe(false)
10+
expect(isNil('')).toBe(false)
11+
})
12+
})

deno.lock

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mod_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ contract HelloWorld {
1818
}
1919
`
2020

21-
describe('solc/wrapper.ts', () => {
21+
describe('Wrapper', () => {
2222
let solc: Wrapper
2323
beforeAll(async () => {
2424
await download('./soljson_test.cjs', '0.8.18')

0 commit comments

Comments
 (0)