Ticket #2454
A minor issue, though it was causing several tests to fail:
Java: echo(69f) --> "69.0" Javascript: echo(69f) --> "69"
Ticket promoted to #2454 and assigned to andy
Another minor toStr difference is with Maps:
toStr
Java: echo( ["Du":"de"] ) // --> [Du:de] Javascript: echo( ["Du":"de"] ) // --> [Du: de]
This works consistently between runtimes:
Obj:Obj? objs = ... str := objs.isEmpty ? "[:]" : "[" + objs.join(",") |v, k| { "$k:$v" } + "]"
Here's a patch and a test for Float.toStr()
Float.toStr()
diff -r a77e9070251b src/sys/js/fan/Float.js --- a/src/sys/js/fan/Float.js Fri Sep 04 09:11:51 2015 -0400 +++ b/src/sys/js/fan/Float.js Fri Sep 18 11:28:59 2015 +0100 @@ -157,7 +157,7 @@ if (isNaN(self)) return "NaN"; if (self == fan.sys.Float.m_posInf) return "INF"; if (self == fan.sys.Float.m_negInf) return "-INF"; - return ""+self; + return (fan.sys.Float.toInt(self) == self) ? self.toFixed(1) : ""+self; } fan.sys.Float.encode = function(self, out) diff -r a77e9070251b src/testSys/fan/FloatTest.fan --- a/src/testSys/fan/FloatTest.fan Fri Sep 04 09:11:51 2015 -0400 +++ b/src/testSys/fan/FloatTest.fan Fri Sep 18 11:28:59 2015 +0100 @@ -487,6 +487,9 @@ Void testToStr() { + verifyEq(69.69f.toStr, "69.69") + verifyEq(69f.toStr, "69.0") + verifyEq(Float.posInf.toStr, "INF") verifyEq(Float.negInf.toStr, "-INF") verifyEq(Float.nan.toStr, "NaN")
and a patch for Map.toStr()
Map.toStr()
diff -r a77e9070251b src/sys/js/fan/Map.js --- a/src/sys/js/fan/Map.js Fri Sep 04 09:11:51 2015 -0400 +++ b/src/sys/js/fan/Map.js Fri Sep 18 11:30:07 2015 +0100 @@ -306,7 +306,7 @@ this.$each(function(b) { if (s.length > 0) s += ", "; - s += b.key + ": " + b.val; + s += b.key + ":" + b.val; }); return "[" + s + "]"; }
Fix for the Map.toStr issue - try to keep issues on separate threads - easier to manage.
Ticket resolved in 1.0.68
Fixed
Thanks for all the patches Steve
Login or Signup to reply.
SlimerDude Sat 5 Sep 2015
A minor issue, though it was causing several tests to fail:
andy Wed 9 Sep 2015
Ticket promoted to #2454 and assigned to andy
SlimerDude Thu 17 Sep 2015
Another minor
toStr
difference is with Maps:This works consistently between runtimes:
SlimerDude Fri 18 Sep 2015
Here's a patch and a test for
Float.toStr()
and a patch for
Map.toStr()
andy Mon 21 Sep 2015
Fix for the Map.toStr issue - try to keep issues on separate threads - easier to manage.
andy Mon 21 Sep 2015
Ticket resolved in 1.0.68
Fixed
Thanks for all the patches Steve