Skip to content

Commit 972ddc4

Browse files
Mingungeneralmimon
authored andcommitted
KS expression language: adjust tests after optimizations in parenthesis generation
Fixes this new errors (parenthesis around expression is not generated anymore): ``` [info] - csharp:[0 + 1, 5].as<bytes> *** FAILED *** [info] "new byte[] { [0 + 1], 5 }" was not equal to "new byte[] { [(0 + 1)], 5 }" (TranslatorSpec.scala:856) [info] Analysis: [info] "new byte[] { [0 + 1], 5 }" -> "new byte[] { [(0 + 1)], 5 }" [info] - go:[0 + 1, 5].as<bytes> *** FAILED *** [info] "[]uint8{[0 + 1], 5}" was not equal to "[]uint8{[(0 + 1)], 5}" (TranslatorSpec.scala:856) [info] Analysis: [info] "[]uint8{[0 + 1], 5}" -> "[]uint8{[(0 + 1)], 5}" [info] - java:[0 + 1, 5].as<bytes> *** FAILED *** [info] "new byte[] { [0 + 1], 5 }" was not equal to "new byte[] { [(0 + 1)], 5 }" (TranslatorSpec.scala:856) [info] Analysis: [info] "new byte[] { [0 + 1], 5 }" -> "new byte[] { [(0 + 1)], 5 }" [info] - javascript:[0 + 1, 5].as<bytes> *** FAILED *** [info] "new Uint8Array([[0 + 1], 5])" was not equal to "new Uint8Array([[(0 + 1)], 5])" (TranslatorSpec.scala:856) [info] Analysis: [info] "new Uint8Array([[0 + 1], 5])" -> "new Uint8Array([[(0 + 1)], 5])" [info] - perl:[0 + 1, 5].as<bytes> *** FAILED *** [info] "pack('C*', ([0 + 1], 5))" was not equal to "pack('C*', ([(0 + 1)], 5))" (TranslatorSpec.scala:856) [info] Analysis: [info] "pack('C*', ([0 + 1], 5))" -> "pack('C*', ([(0 + 1)], 5))" [info] - php:[0 + 1, 5].as<bytes> *** FAILED *** [info] "pack('C*', [0 + 1], 5)" was not equal to "pack('C*', [(0 + 1)], 5)" (TranslatorSpec.scala:856) [info] Analysis: [info] "pack('C*', [0 + 1], 5)" -> "pack('C*', [(0 + 1)], 5)" [info] - python:[0 + 1, 5].as<bytes> *** FAILED *** [info] "struct.pack('2B', [0 + 1], 5)" was not equal to "struct.pack('2B', [(0 + 1)], 5)" (TranslatorSpec.scala:856) [info] Analysis: [info] "struct.pack('2B', [0 + 1], 5)" -> "struct.pack('2B', [(0 + 1)], 5)" [info] - ruby:[0 + 1, 5].as<bytes> *** FAILED *** [info] "[[0 + 1], 5].pack('C*')" was not equal to "[[(0 + 1)], 5].pack('C*')" (TranslatorSpec.scala:856) [info] Analysis: [info] "[[0 + 1], 5].pack('C*')" -> "[[(0 + 1)], 5].pack('C*')" ```
1 parent c0f1e95 commit 972ddc4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

jvm/src/test/scala/io/kaitai/struct/translators/TranslatorSpec.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -855,15 +855,15 @@ class TranslatorSpec extends AnyFunSpec {
855855
// type enforcement: casting to non-literal byte array
856856
full("[0 + 1, 5].as<bytes>", CalcIntType, CalcBytesType, ResultMap(
857857
CppCompiler -> "???",
858-
CSharpCompiler -> "new byte[] { (0 + 1), 5 }",
859-
GoCompiler -> "[]uint8{(0 + 1), 5}",
860-
JavaCompiler -> "new byte[] { (0 + 1), 5 }",
861-
JavaScriptCompiler -> "new Uint8Array([(0 + 1), 5])",
858+
CSharpCompiler -> "new byte[] { 0 + 1, 5 }",
859+
GoCompiler -> "[]uint8{0 + 1, 5}",
860+
JavaCompiler -> "new byte[] { 0 + 1, 5 }",
861+
JavaScriptCompiler -> "new Uint8Array([0 + 1, 5])",
862862
LuaCompiler -> "???",
863-
PerlCompiler -> "pack('C*', ((0 + 1), 5))",
864-
PHPCompiler -> "pack('C*', (0 + 1), 5)",
865-
PythonCompiler -> "struct.pack('2B', (0 + 1), 5)",
866-
RubyCompiler -> "[(0 + 1), 5].pack('C*')"
863+
PerlCompiler -> "pack('C*', (0 + 1, 5))",
864+
PHPCompiler -> "pack('C*', 0 + 1, 5)",
865+
PythonCompiler -> "struct.pack('2B', 0 + 1, 5)",
866+
RubyCompiler -> "[0 + 1, 5].pack('C*')"
867867
))
868868

869869
// type enforcement: casting to array of integers

0 commit comments

Comments
 (0)