From 23de295a3bb446e98bb5f7641d3874c3b4b19a62 Mon Sep 17 00:00:00 2001 From: Mingun Date: Fri, 8 Mar 2024 12:21:28 +0500 Subject: [PATCH] Base 10 does not passed to to_string methods since 7be4a2b1163e14441b3d9cd609a5829cd20c5383 Affected languages: - C# (also usage of Convert.ToString() was replaced by ordinal .ToString() in the same commit) - Java - JavaScript - Ruby Fixes [info] - csharp:f"abc{1}%def" *** FAILED *** [info] ""abc" + [(1).ToString(]) + "%def"" was not equal to ""abc" + [Convert.ToString((long) (1), 10]) + "%def"" (TranslatorSpec.scala:686) [info] Analysis: [info] ""abc" + [(1).ToString(]) + "%def"" -> ""abc" + [Convert.ToString((long) (1), 10]) + "%def"" [info] - java:f"abc{1}%def" *** FAILED *** [info] "...c" + Long.toString(1[]) + "%def"" was not equal to "...c" + Long.toString(1[, 10]) + "%def"" (TranslatorSpec.scala:686) [info] Analysis: [info] "...c" + Long.toString(1[]) + "%def"" -> "...c" + Long.toString(1[, 10]) + "%def"" [info] - javascript:f"abc{1}%def" *** FAILED *** [info] "...abc" + (1).toString([]) + "%def"" was not equal to "...abc" + (1).toString([10]) + "%def"" (TranslatorSpec.scala:686) [info] Analysis: [info] "...abc" + (1).toString([]) + "%def"" -> "...abc" + (1).toString([10]) + "%def"" [info] - ruby:f"abc{1}%def" *** FAILED *** [info] ""abc" + 1.to_s[] + "%def"" was not equal to ""abc" + 1.to_s[(10)] + "%def"" (TranslatorSpec.scala:686) [info] Analysis: [info] ""abc" + 1.to_s[] + "%def"" -> ""abc" + 1.to_s[(10)] + "%def"" --- .../io/kaitai/struct/translators/TranslatorSpec.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 d4ceccd90..fde6d6346 100644 --- a/jvm/src/test/scala/io/kaitai/struct/translators/TranslatorSpec.scala +++ b/jvm/src/test/scala/io/kaitai/struct/translators/TranslatorSpec.scala @@ -685,15 +685,15 @@ class TranslatorSpec extends AnyFunSuite { full("f\"abc{1}%def\"", CalcIntType, CalcStrType, Map[LanguageCompilerStatic, String]( CppCompiler -> "std::string(\"abc\") + kaitai::kstream::to_string(1) + std::string(\"%def\")", - CSharpCompiler -> "\"abc\" + Convert.ToString((long) (1), 10) + \"%def\"", + CSharpCompiler -> "\"abc\" + (1).ToString() + \"%def\"", GoCompiler -> "fmt.Sprintf(\"abc%v%%def\", 1)", - JavaCompiler -> "\"abc\" + Long.toString(1, 10) + \"%def\"", - JavaScriptCompiler -> "\"abc\" + (1).toString(10) + \"%def\"", + JavaCompiler -> "\"abc\" + Long.toString(1) + \"%def\"", + JavaScriptCompiler -> "\"abc\" + (1).toString() + \"%def\"", LuaCompiler -> "\"abc\" .. tostring(1) .. \"%def\"", PerlCompiler -> "\"abc\" . sprintf('%d', 1) . \"\\%def\"", PHPCompiler -> "\"abc\" . strval(1) . \"%def\"", PythonCompiler -> "u\"abc\" + str(1) + u\"%def\"", - RubyCompiler -> "\"abc\" + 1.to_s(10) + \"%def\"", + RubyCompiler -> "\"abc\" + 1.to_s + \"%def\"", )) /**