Skip to content

Commit

Permalink
Base 10 does not passed to to_string methods since 7be4a2b
Browse files Browse the repository at this point in the history
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""
  • Loading branch information
Mingun committed Mar 8, 2024
1 parent 286d2a3 commit 23de295
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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\"",
))

/**
Expand Down

0 comments on commit 23de295

Please sign in to comment.