From 4cd8d59a72b0e23698db20360b3148c3dd9e3f8d Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Tue, 27 Aug 2024 15:21:07 +0200 Subject: [PATCH] TranslatorSpec: fix tests broken in 37fd6335e242 --- .../io/kaitai/struct/translators/TranslatorSpec.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jvm/src/test/scala/io/kaitai/struct/translators/TranslatorSpec.scala b/jvm/src/test/scala/io/kaitai/struct/translators/TranslatorSpec.scala index d148ad89d..8db8d279a 100644 --- a/jvm/src/test/scala/io/kaitai/struct/translators/TranslatorSpec.scala +++ b/jvm/src/test/scala/io/kaitai/struct/translators/TranslatorSpec.scala @@ -701,7 +701,7 @@ class TranslatorSpec extends AnyFunSpec { PerlCompiler -> "substr(\"foobar\", 2, 4 - 2)", PHPCompiler -> "\\Kaitai\\Struct\\Stream::substring(\"foobar\", 2, 4)", PythonCompiler -> "u\"foobar\"[2:4]", - RubyCompiler -> "\"foobar\"[2..4 - 1]" + RubyCompiler -> "\"foobar\"[2...4]" )) // substring() call on concatenation of strings: for some languages, concatenation needs to be @@ -716,7 +716,7 @@ class TranslatorSpec extends AnyFunSpec { PerlCompiler -> "substr($self->foo() . $self->bar(), 2, 4 - 2)", PHPCompiler -> "\\Kaitai\\Struct\\Stream::substring($this->foo() . $this->bar(), 2, 4)", PythonCompiler -> "(self.foo + self.bar)[2:4]", - RubyCompiler -> "(foo + bar)[2..4 - 1]" + RubyCompiler -> "(foo + bar)[2...4]" )) // substring() call with non-left-associative "from" and "to": for languages where subtraction @@ -731,7 +731,7 @@ class TranslatorSpec extends AnyFunSpec { PerlCompiler -> "substr($self->foo(), 10 - 7, (10 - 3) - (10 - 7))", // TODO: PerlCompiler -> "substr($self->foo(), 10 - 7, 10 - 3 - (10 - 7))", PHPCompiler -> "\\Kaitai\\Struct\\Stream::substring($this->foo(), 10 - 7, 10 - 3)", PythonCompiler -> "self.foo[10 - 7:10 - 3]", - RubyCompiler -> "foo[10 - 7..(10 - 3) - 1]" // TODO: RubyCompiler -> "foo[10 - 7..10 - 3 - 1]" + RubyCompiler -> "foo[10 - 7...10 - 3]" )) // substring() call with "to" using `<<` which is lower precedence than `+` or `-`: if such @@ -746,7 +746,7 @@ class TranslatorSpec extends AnyFunSpec { PerlCompiler -> "substr($self->foo(), 10 - 7, (10 << 2) - (10 - 7))", PHPCompiler -> "\\Kaitai\\Struct\\Stream::substring($this->foo(), 10 - 7, 10 << 2)", PythonCompiler -> "self.foo[10 - 7:10 << 2]", - RubyCompiler -> "foo[10 - 7..(10 << 2) - 1]" + RubyCompiler -> "foo[10 - 7...10 << 2]" )) // substring() call with "from" using `<<` which is lower precedence than `+` or `-`: if such @@ -761,7 +761,7 @@ class TranslatorSpec extends AnyFunSpec { PerlCompiler -> "substr($self->foo(), 10 << 1, 42 - (10 << 1))", PHPCompiler -> "\\Kaitai\\Struct\\Stream::substring($this->foo(), 10 << 1, 42)", PythonCompiler -> "self.foo[10 << 1:42]", - RubyCompiler -> "foo[10 << 1..42 - 1]" + RubyCompiler -> "foo[10 << 1...42]" )) } }