Skip to content

Commit

Permalink
rake format
Browse files Browse the repository at this point in the history
  • Loading branch information
kateinoigakukun committed Jan 2, 2024
1 parent cbc1ad7 commit 81b72e3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/npm-packages/ruby-wasm-wasi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ See [Cheat Sheet](https://github.com/ruby/ruby.wasm/blob/main/docs/cheat_sheet.m

## Ruby Version Support

| Version | Package |
| ------- | -------------------------------------------------- |
| Version | Package |
| ------- | --------------------------------------------------------------------------------------------------------------- |
| `head` | [`@ruby/head-wasm-wasi`](https://github.com/ruby/ruby.wasm/tree/main/packages/npm-packages/ruby-head-wasm-wasi) |
| `3.3` | [`@ruby/3.3-wasm-wasi`](https://github.com/ruby/ruby.wasm/tree/main/packages/npm-packages/ruby-3.3-wasm-wasi) |
| `3.2` | [`@ruby/3.2-wasm-wasi`](https://github.com/ruby/ruby.wasm/tree/main/packages/npm-packages/ruby-3.2-wasm-wasi) |
Expand Down
10 changes: 8 additions & 2 deletions packages/npm-packages/ruby-wasm-wasi/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,9 @@ class RbExceptionFormatter {
// but checking re-entrancy just in case.
class RbExceptionFormatterError extends Error {}
if (this.isFormmatting) {
throw new RbExceptionFormatterError("Unexpected exception occurred during formatting exception message");
throw new RbExceptionFormatterError(
"Unexpected exception occurred during formatting exception message",
);
}
this.isFormmatting = true;
try {
Expand All @@ -555,7 +557,11 @@ class RbExceptionFormatter {
}
}

private _format(error: RbValue, vm: RubyVM, privateObject: RubyVMPrivate): string {
private _format(
error: RbValue,
vm: RubyVM,
privateObject: RubyVMPrivate,
): string {
const [zeroLiteral, oneLiteral, newLineLiteral] = (() => {
if (this.literalsCache == null) {
const zeroOneNewLine: [RbValue, RbValue, RbValue] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def test_get_location_with_relative_path
end

def test_get_location_with_relative_path_and_filename
url_resolver = JS::RequireRemote::URLResolver.new("https://example.com/bar.rb")
url_resolver =
JS::RequireRemote::URLResolver.new("https://example.com/bar.rb")
script_location = url_resolver.get_location("./foo.rb")
assert_equal "https://example.com/foo.rb", script_location.url.to_s
assert_equal "./foo.rb", script_location.filename
Expand All @@ -32,21 +33,24 @@ def test_get_location_with_relative_path_and_filename_without_extension
end

def test_get_location_with_relative_path_and_directory
url_resolver = JS::RequireRemote::URLResolver.new("https://example.com/bar/")
url_resolver =
JS::RequireRemote::URLResolver.new("https://example.com/bar/")
script_location = url_resolver.get_location("./foo.rb")
assert_equal "https://example.com/bar/foo.rb", script_location.url.to_s
assert_equal "./foo.rb", script_location.filename
end

def test_get_location_with_backward_relative_path
url_resolver = JS::RequireRemote::URLResolver.new("https://example.com/bar/")
url_resolver =
JS::RequireRemote::URLResolver.new("https://example.com/bar/")
script_location = url_resolver.get_location("../foo.rb")
assert_equal "https://example.com/foo.rb", script_location.url.to_s
assert_equal "../foo.rb", script_location.filename
end

def test_get_location_with_backward_relative_path_and_filename
url_resolver = JS::RequireRemote::URLResolver.new("https://example.com/baz.rb")
url_resolver =
JS::RequireRemote::URLResolver.new("https://example.com/baz.rb")
script_location = url_resolver.get_location("../foo.rb")
assert_equal "https://example.com/foo.rb", script_location.url.to_s
assert_equal "../foo.rb", script_location.filename
Expand Down
5 changes: 2 additions & 3 deletions packages/npm-packages/ruby-wasm-wasi/test/vm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@ eval:11:in \`<main>'`);
end
raise BrokenException.new
`);
}
expect(throwError)
.toThrowError(`BrokenException: unknown`);
};
expect(throwError).toThrowError(`BrokenException: unknown`);
});

test("eval encoding", async () => {
Expand Down

0 comments on commit 81b72e3

Please sign in to comment.