summaryrefslogtreecommitdiff
path: root/dart
diff options
context:
space:
mode:
authorJames Kuszmaul <jkuszmaul@users.noreply.github.com>2022-11-08 10:59:46 -0800
committerGitHub <noreply@github.com>2022-11-08 10:59:46 -0800
commit8aa8b9139eb330f27816a5b8b5bbef402fbe3632 (patch)
tree663239599f6db431f1efe8b787c201aa53388dbc /dart
parent001adf782dba8e9fa869b15389725b3eab32e51b (diff)
downloadflatbuffers-8aa8b9139eb330f27816a5b8b5bbef402fbe3632.tar.gz
flatbuffers-8aa8b9139eb330f27816a5b8b5bbef402fbe3632.tar.bz2
flatbuffers-8aa8b9139eb330f27816a5b8b5bbef402fbe3632.zip
Fix handling of +/-inf defaults in TS/rust/go/dart codegen (#7588)
+/-inf were not being handled, and so invalid typescript was being generated when a float/double had an infinite default value. NaN was being handled correctly. Co-authored-by: Derek Bailey <derekbailey@google.com> Co-authored-by: Casper <casperneo@uchicago.edu>
Diffstat (limited to 'dart')
-rw-r--r--dart/test/flat_buffers_test.dart15
1 files changed, 12 insertions, 3 deletions
diff --git a/dart/test/flat_buffers_test.dart b/dart/test/flat_buffers_test.dart
index 5298b170..000ccff6 100644
--- a/dart/test/flat_buffers_test.dart
+++ b/dart/test/flat_buffers_test.dart
@@ -87,7 +87,10 @@ class CheckOtherLangaugesData {
'testrequirednestedflatbuffer: null, scalarKeySortedTables: null, '
'nativeInline: null, '
'longEnumNonEnumDefault: LongEnum{value: 0}, '
- 'longEnumNormalDefault: LongEnum{value: 2}}, '
+ 'longEnumNormalDefault: LongEnum{value: 2}, nanDefault: NaN, '
+ 'infDefault: Infinity, positiveInfDefault: Infinity, infinityDefault: '
+ 'Infinity, positiveInfinityDefault: Infinity, negativeInfDefault: '
+ '-Infinity, negativeInfinityDefault: -Infinity, doubleInfDefault: Infinity}, '
'test4: [Test{a: 10, b: 20}, Test{a: 30, b: 40}], '
'testarrayofstring: [test1, test2], testarrayoftables: null, '
'enemy: Monster{pos: null, mana: 150, hp: 100, name: Fred, '
@@ -110,7 +113,10 @@ class CheckOtherLangaugesData {
'testrequirednestedflatbuffer: null, scalarKeySortedTables: null, '
'nativeInline: null, '
'longEnumNonEnumDefault: LongEnum{value: 0}, '
- 'longEnumNormalDefault: LongEnum{value: 2}}, '
+ 'longEnumNormalDefault: LongEnum{value: 2}, nanDefault: NaN, '
+ 'infDefault: Infinity, positiveInfDefault: Infinity, infinityDefault: '
+ 'Infinity, positiveInfinityDefault: Infinity, negativeInfDefault: '
+ '-Infinity, negativeInfinityDefault: -Infinity, doubleInfDefault: Infinity}, '
'testnestedflatbuffer: null, testempty: null, testbool: true, '
'testhashs32Fnv1: -579221183, testhashu32Fnv1: 3715746113, '
'testhashs64Fnv1: 7930699090847568257, '
@@ -137,7 +143,10 @@ class CheckOtherLangaugesData {
'miss, val: 0, count: 0}, Stat{id: hit, val: 10, count: 1}], '
'nativeInline: Test{a: 1, b: 2}, '
'longEnumNonEnumDefault: LongEnum{value: 0}, '
- 'longEnumNormalDefault: LongEnum{value: 2}}',
+ 'longEnumNormalDefault: LongEnum{value: 2}, nanDefault: NaN, '
+ 'infDefault: Infinity, positiveInfDefault: Infinity, infinityDefault: '
+ 'Infinity, positiveInfinityDefault: Infinity, negativeInfDefault: '
+ '-Infinity, negativeInfinityDefault: -Infinity, doubleInfDefault: Infinity}'
);
}
}