Skip to content
Browse files

Amend test so it doesn't use "+" for string concatenation.

Using Array.join("") is an unclean solution. I don't want to understand
what makes Firefox consider these this expression to return NaN:

     "\u30BD\u30FC\u30B7\u30E3\u30EB\u30FB\u30CD\u30C3"
     +"\u30C8\u30EF\u30FC\u30AD\u30F3\u30B0 \u30B5\u30FC",

It seems as if Firefox (or Javascript) want to use something like
looks_like_number() but don't have separate operators for numerical
addition and string concatenation. :-(
  • Loading branch information...
1 parent f0c4489 commit 5f412db9f72aa521dcd6e9a2237398b9fbf3b28e Max Maischein committed
Showing with 20 additions and 3 deletions.
  1. +12 −0 Changes
  2. +8 −3 t/03-unicode.t
View
12 Changes
@@ -8,6 +8,18 @@ To-do:
. Automatically load the AnyEvent backend if needed.
. Implement ->can() for MozRepl objects
+0.34 to be released
+ ! Firefox 16 now seems to treat String concatenation with the "+"
+ operator in a bad way:
+ "\u30BD\u30FC\u30B7\u30E3\u30EB\u30FB\u30CD\u30C3"
+ + "\u30C8\u30EF\u30FC\u30AD\u30F3\u30B0 \u30B5\u30FC"
+ results in NaN , which means that something in there gets
+ interpreted as number. This is different from previous Firefox
+ versions.
+ The change is only in the tests - they now use Array.join("")
+ for string concatenation.
+
+
0.33 20120901
. ->__click() directly calls target.click() if the target has
a .click field.
View
11 t/03-unicode.t
@@ -17,6 +17,8 @@ if (! $ok) {
plan tests => 5;
};
+diag $repl->{js_JSON};
+
my $expected =
"\x{30BD}\x{30FC}\x{30B7}\x{30E3}\x{30EB}\x{30FB}\x{30CD}\x{30C3}\x{30C8}"
. "\x{30EF}\x{30FC}\x{30AD}\x{30F3}\x{30B0} \x{30B5}\x{30FC}\x{30D3}\x{30B9}"
@@ -25,9 +27,12 @@ my $expected =
# Set the title using (encoded) JS
my $newtitle = $repl->expr(<<'JS');
// Thanks to Toru Yamaguchi for the testcase
- "\u30BD\u30FC\u30B7\u30E3\u30EB\u30FB\u30CD\u30C3"
- +"\u30C8\u30EF\u30FC\u30AD\u30F3\u30B0 \u30B5\u30FC"
- +"\u30D3\u30B9 [mixi(\u30DF\u30AF\u30B7\u30A3)]"
+ // Force Javascript "+" operator into string mode :-(
+ [
+ "\u30BD\u30FC\u30B7\u30E3\u30EB\u30FB\u30CD\u30C3",
+ "\u30C8\u30EF\u30FC\u30AD\u30F3\u30B0 \u30B5\u30FC",
+ "\u30D3\u30B9 [mixi(\u30DF\u30AF\u30B7\u30A3)]"
+ ].join("")
JS
like $newtitle, qr/mixi/, "The ASCII part doesn't look too bad";

0 comments on commit 5f412db

Please sign in to comment.
Something went wrong with that request. Please try again.