[wasm][debugger] Support indexing Dictionary by string key (#90108)
authorThays Grazia <thaystg@gmail.com>
Tue, 8 Aug 2023 00:05:30 +0000 (21:05 -0300)
committerGitHub <noreply@github.com>
Tue, 8 Aug 2023 00:05:30 +0000 (21:05 -0300)
* Enabling tests, they are working.

* Adding more tests.

src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs

index ad413c0..784ba1d 100644 (file)
@@ -633,17 +633,19 @@ namespace DebuggerTests
                     ("f[\"-\"]", TBool(false)),
                     ("f[\'-\']", TString("res_-")),
                     ("f[true]", TString("True")),
-                    // ("f[1.23]", TNumber(1)) // Not supported yet - float/double
-
-                    // FixMe: https://github.com/dotnet/runtime/issues/76013
-                    // ("f.indexedByStr[\"1\"]", TBool(true)) // keyNotFoundException
-                    // ("f.indexedByStr[\"111\"]", TBool(false)), // keyNotFoundException
-                    // ("f.indexedByStr[\"true\"]", TBool(true)), // keyNotFoundException
+                    //("f[1.23]", TNumber(1)) // Not supported yet - float/double
+                    ("f.indexedByStr[\"1\"]", TBool(true)),
+                    ("f.indexedByStr[\"111\"]", TBool(false)),
+                    ("f.indexedByStr[\"true\"]", TBool(true)),
                     ("f.indexedByChar[\'i\']", TString("I")),
                     ("f.indexedByChar[\'5\']", TString("5")),
                     ("f.indexedByBool[true]", TString("TRUE")),
                     ("f.indexedByBool[false]", TString("FALSE"))
                 );
+                var (_, res) = await EvaluateOnCallFrame(id,"f.indexedByStr[\"invalid\"]", expect_ok: false);
+                Assert.True(res.Error["result"]?["description"]?.Value<string>().StartsWith("Cannot evaluate '(f.indexedByStr[\"invalid\"]", StringComparison.Ordinal)); 
+                (_, res) = await EvaluateOnCallFrame(id,"f.indexedByStr[null]", expect_ok: false);
+                Assert.True(res.Error["result"]?["description"]?.Value<string>().StartsWith("Cannot evaluate '(f.indexedByStr[null]", StringComparison.Ordinal)); 
             });
 
         [Fact]