diff --git a/ReactCommon/hermes/inspector/chrome/tests/ConnectionTests.cpp b/ReactCommon/hermes/inspector/chrome/tests/ConnectionTests.cpp index 18208192f67009..2f7a4003a4fb29 100644 --- a/ReactCommon/hermes/inspector/chrome/tests/ConnectionTests.cpp +++ b/ReactCommon/hermes/inspector/chrome/tests/ConnectionTests.cpp @@ -748,6 +748,46 @@ TEST(ConnectionTests, testSetBreakpointById) { expectNotification(conn); } +TEST(ConnectionTests, testSetBreakpointByIdWithColumnInIndenting) { + TestContext context; + AsyncHermesRuntime &asyncRuntime = context.runtime(); + SyncConnection &conn = context.conn(); + int msgId = 1; + + asyncRuntime.executeScriptAsync(R"( + debugger; // line 1 + Math.random(); // 2 + )"); + + send(conn, ++msgId); + expectExecutionContextCreated(conn); + auto script = expectNotification(conn); + + expectPaused(conn, "other", {{"global", 1, 1}}); + + m::debugger::SetBreakpointRequest req; + req.id = ++msgId; + req.location.scriptId = script.scriptId; + req.location.lineNumber = 2; + // Specify a column location *before* rather than *on* the actual location + req.location.columnNumber = 0; + + conn.send(req.toJson()); + auto resp = expectResponse(conn, req.id); + EXPECT_EQ(resp.actualLocation.scriptId, script.scriptId); + EXPECT_EQ(resp.actualLocation.lineNumber, 2); + // Check that we resolved the column to the first available location + EXPECT_EQ(resp.actualLocation.columnNumber.value(), 4); + + send(conn, ++msgId); + expectNotification(conn); + + expectPaused(conn, "other", {{"global", 2, 1}}); + + send(conn, ++msgId); + expectNotification(conn); +} + TEST(ConnectionTests, testSetLazyBreakpoint) { TestContext context; AsyncHermesRuntime &asyncRuntime = context.runtime();