mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
[Feature] Checks for Nullable strings (#6050)
* Allows null strings in createString method c# * Adds nullable strings to JS and swift * Changes js checks * Fixes typo
This commit is contained in:
@@ -50,7 +50,9 @@ function main() {
|
||||
test64bit();
|
||||
testUnicode();
|
||||
fuzzTest1();
|
||||
|
||||
testNullStrings();
|
||||
testSharedStrings();
|
||||
|
||||
console.log('FlatBuffers test: completed successfully');
|
||||
}
|
||||
|
||||
@@ -437,4 +439,19 @@ function fuzzTest1() {
|
||||
}
|
||||
}
|
||||
|
||||
function testSharedStrings() {
|
||||
var shared_string = "Hello world";
|
||||
var builder = new flatbuffers.Builder();
|
||||
let mainOffset = builder.createSharedString(shared_string);
|
||||
assert.strictEqual(builder.createSharedString(shared_string), mainOffset);
|
||||
}
|
||||
|
||||
function testNullStrings() {
|
||||
var builder = new flatbuffers.Builder();
|
||||
assert.strictEqual(builder.createString(null), 0);
|
||||
assert.strictEqual(builder.createSharedString(null), 0);
|
||||
assert.strictEqual(builder.createString(undefined), 0);
|
||||
assert.strictEqual(builder.createSharedString(undefined), 0);
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
Reference in New Issue
Block a user