-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix js str decode #727
fix js str decode #727
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
import test from 'ava'; | ||
import { MyString, Float64Vec} from "diplomat-wasm-js-feature-tests"; | ||
import test from "ava"; | ||
import { MyString, Float64Vec } from "diplomat-wasm-js-feature-tests"; | ||
|
||
test("MyString functionality", (t) => { | ||
let str = MyString.new_("This is a test value."); | ||
t.is(str.str, "This is a test value."); | ||
let str = MyString.new_("This is a test value."); | ||
t.is(str.str, "This is a test value."); | ||
}); | ||
|
||
test("String List", (t) => { | ||
let str = MyString.newFromFirst(["This", "is", "a", "test."]); | ||
t.is(str.str, "This"); | ||
let str = MyString.newFromFirst(["This", "is", "a", "test."]); | ||
t.is(str.str, "This"); | ||
}); | ||
|
||
test("MyString borrow", (t) => { | ||
let str = MyString.new_("This is a test."); | ||
t.is(str.borrow(), "This is a test."); | ||
}); | ||
|
||
test("Float64Vec", (t) => { | ||
let input = [1, 2, 3, 4, 5]; | ||
let data = Float64Vec.newIsize(input); | ||
t.deepEqual(data.borrow(), input); | ||
let input = [1, 2, 3, 4, 5]; | ||
let data = Float64Vec.newIsize(input); | ||
t.deepEqual(data.borrow(), input); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,7 +244,7 @@ impl<'jsctx, 'tcx> TyGenContext<'jsctx, 'tcx> { | |
) | ||
.into(), | ||
hir::Slice::Str(_, encoding) => format!( | ||
r#"new diplomatRuntime.DiplomatSliceStr(wasm, {variable_name}, "string{}", {edges})"#, | ||
r#"new diplomatRuntime.DiplomatSliceStr(wasm, {variable_name}, "string{}", {edges}).getValue()"#, | ||
match encoding { | ||
hir::StringEncoding::Utf8 | hir::StringEncoding::UnvalidatedUtf8 => 8, | ||
hir::StringEncoding::UnvalidatedUtf16 => 16, | ||
|
@@ -257,7 +257,7 @@ impl<'jsctx, 'tcx> TyGenContext<'jsctx, 'tcx> { | |
// We basically iterate through and read each string into the array. | ||
// TODO: Need a test for this. | ||
format!( | ||
r#"new diplomatRuntime.DiplomatSliceStrings(wasm, {variable_name}, "string{}", {edges})"#, | ||
r#"new diplomatRuntime.DiplomatSliceStrings(wasm, {variable_name}, "string{}", {edges}).getValue()"#, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as i could see there isn't actually a |
||
match encoding { | ||
hir::StringEncoding::Utf8 | ||
| hir::StringEncoding::UnvalidatedUtf8 => 8, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my editor reformatted some stuff. I hope this is okay.