-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure resource imports and exports use kebab case (#151)
- Loading branch information
1 parent
5197559
commit 97fe6aa
Showing
6 changed files
with
32 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export class Float { | ||
export class MyFloat { | ||
constructor(value) { | ||
this.value = value + 1 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import { strictEqual } from 'node:assert'; | ||
import { Float as HostFloat } from "./resource-floats.js"; | ||
import { MyFloat as HostFloat } from "./resource-floats.js"; | ||
|
||
export function test(instance) { | ||
const { Float } = instance.resourceFloatsExports; | ||
const { MyFloat } = instance.resourceFloatsExports; | ||
|
||
let float1 = new HostFloat(42); | ||
let float2 = new HostFloat(55); | ||
|
||
strictEqual(instance.add(float1, float2).value, 42 + 1 + 3 + 55 + 1 + 3 + 5 + 1); | ||
|
||
let float3 = new Float(22); | ||
let float3 = new MyFloat(22); | ||
|
||
strictEqual(float3.get(), 22 + 1 + 2 + 4 + 3); | ||
|
||
let result = Float.add(float3, 7); | ||
let result = MyFloat.add(float3, 7); | ||
|
||
strictEqual(result.get(), 22 + 1 + 2 + 7 + 6 + 2 + 4 + 5 + 1 + 2 + 4 + 3); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
package test:test; | ||
|
||
interface resource-floats { | ||
resource float { | ||
resource my-float { | ||
constructor(v: f64); | ||
get: func() -> f64; | ||
} | ||
} | ||
|
||
world test { | ||
use resource-floats.{float}; | ||
use resource-floats.{my-float}; | ||
|
||
export resource-floats-exports: interface { | ||
resource float { | ||
resource my-float { | ||
constructor(v: f64); | ||
get: func() -> f64; | ||
add: static func(a: float, b: f64) -> float; | ||
add: static func(a: my-float, b: f64) -> my-float; | ||
} | ||
} | ||
|
||
import resource-floats-imports: interface { | ||
resource float { | ||
resource my-float { | ||
constructor(v: f64); | ||
get: func() -> f64; | ||
add: static func(a: float, b: f64) -> float; | ||
add: static func(a: my-float, b: f64) -> my-float; | ||
} | ||
} | ||
|
||
export add: func(a: borrow<float>, b: borrow<float>) -> own<float>; | ||
export add: func(a: borrow<my-float>, b: borrow<my-float>) -> own<my-float>; | ||
} |