From 6cf15f4ea1fe044d8227440dcc30ac712334568e Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 27 Feb 2025 10:32:14 -0800 Subject: Allow `.member` syntax on vector and scalars. (#6424) * Allow `.member` syntax on vector and scalars. * Fix. * fix. * Fix. * update comment. * Fix tests. * Fix warning. * Add more tests. --- tools/slang-test/slang-test-main.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'tools') diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp index 10bc99017..57328c210 100644 --- a/tools/slang-test/slang-test-main.cpp +++ b/tools/slang-test/slang-test-main.cpp @@ -2037,9 +2037,13 @@ TestResult runLanguageServerTest(TestContext* context, TestInput& input) int callId = 2; for (auto line : lines) { - if (line.startsWith("//COMPLETE:")) + line = line.trimStart(); + if (!line.startsWith("//")) + continue; + line = line.tail(2).trimStart(); + if (line.startsWith("COMPLETE:")) { - auto arg = line.tail(UnownedStringSlice("//COMPLETE:").getLength()); + auto arg = line.tail(UnownedStringSlice("COMPLETE:").getLength()); Int linePos, colPos; parseLocation(arg, 0, linePos, colPos); @@ -2074,9 +2078,9 @@ TestResult runLanguageServerTest(TestContext* context, TestInput& input) } } } - else if (line.startsWith("//SIGNATURE:")) + else if (line.startsWith("SIGNATURE:")) { - auto arg = line.tail(UnownedStringSlice("//SIGNATURE:").getLength()); + auto arg = line.tail(UnownedStringSlice("SIGNATURE:").getLength()); Int linePos, colPos; parseLocation(arg, 0, linePos, colPos); @@ -2116,9 +2120,9 @@ TestResult runLanguageServerTest(TestContext* context, TestInput& input) } } } - else if (line.startsWith("//HOVER:")) + else if (line.startsWith("HOVER:")) { - auto arg = line.tail(UnownedStringSlice("//HOVER:").getLength()); + auto arg = line.tail(UnownedStringSlice("HOVER:").getLength()); Int linePos, colPos; parseLocation(arg, 0, linePos, colPos); @@ -2150,7 +2154,7 @@ TestResult runLanguageServerTest(TestContext* context, TestInput& input) actualOutputSB << "\ncontent:\n" << hover.contents.value << "\n"; } } - else if (line.startsWith("//DIAGNOSTICS")) + else if (line.startsWith("DIAGNOSTICS")) { if (!diagnosticsReceived) { -- cgit v1.2.3