diff --git a/tests/webidl/output.txt b/tests/webidl/output.txt index 9d99d9496..f60e383fc 100644 --- a/tests/webidl/output.txt +++ b/tests/webidl/output.txt @@ -49,9 +49,10 @@ caught: a JSImplementation must implement all functions, you forgot Child2JS::vi |hello|43|world|41| 12.35 a returned string -C string address: "string A" 0xa30 -C string address: "string B" 0xa40 -C string address: "string A" 0xa30 +C string addresses: "string A" ? "string A" => 0 +C string addresses: "string B" ? "string B" => 0 +C string addresses: "string A" ? "string B" => -1 +C string addresses: "string B" ? "string A" => 1 10 object 10 diff --git a/tests/webidl/post.js b/tests/webidl/post.js index b06e6305d..8697c1121 100644 --- a/tests/webidl/post.js +++ b/tests/webidl/post.js @@ -104,9 +104,10 @@ suser.PrintFloat(12.3456); TheModule.print(suser.returnAString()); // Verify that subsequent calls with the same string value re-use the string storage. -suser.PrintCStringAddress("string A"); -suser.PrintCStringAddress("string B"); -suser.PrintCStringAddress("string A"); +suser.CompareCStringAddress("string A", "string A"); +suser.CompareCStringAddress("string B", "string B"); +suser.CompareCStringAddress("string A", "string B"); +suser.CompareCStringAddress("string B", "string A"); var bv = new TheModule.RefUser(10); var bv2 = new TheModule.RefUser(11); diff --git a/tests/webidl/test.h b/tests/webidl/test.h index 683e8efeb..cf3de3997 100644 --- a/tests/webidl/test.h +++ b/tests/webidl/test.h @@ -60,8 +60,8 @@ public: void PrintFloat(float f) { printf("%.2f\n", f); } const char* returnAString() { return "a returned string"; } - void PrintCStringAddress(const char* s) { - printf("C string address: \"%s\" %p\n", s, s); + void CompareCStringAddress(const char* s1, const char* s2) { + printf("C string addresses: \"%s\" ? \"%s\" => %d\n", s1, s2, s1 < s2 ? -1 : (s1 == s2 ? 0 : 1)); } }; diff --git a/tests/webidl/test.idl b/tests/webidl/test.idl index 64cd6c50d..9809df865 100644 --- a/tests/webidl/test.idl +++ b/tests/webidl/test.idl @@ -52,7 +52,7 @@ interface StringUser { void Print(long anotherInteger, DOMString anotherString); void PrintFloat(float f); [Const] DOMString returnAString(); - void PrintCStringAddress(DOMString str); + void CompareCStringAddress(DOMString str1, DOMString str2); }; interface RefUser {