From c8b408dc05ed19c9afd7d77f04b610d669e292e0 Mon Sep 17 00:00:00 2001 From: Sung-Shik Jongmans Date: Wed, 10 Jul 2024 12:28:40 +0200 Subject: [PATCH] Call `npx` directly from Rascal --- .../rascal/lang/textmate/ConversionTests.rsc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/rascal-textmate-core/src/main/rascal/lang/textmate/ConversionTests.rsc b/rascal-textmate-core/src/main/rascal/lang/textmate/ConversionTests.rsc index 7ea52fd..7507b0f 100644 --- a/rascal-textmate-core/src/main/rascal/lang/textmate/ConversionTests.rsc +++ b/rascal-textmate-core/src/main/rascal/lang/textmate/ConversionTests.rsc @@ -71,7 +71,7 @@ bool doTransformTest(list[ConversionUnit] units, RepositoryStats expect, str nam assert (true | it && s in repo | r <- pats, include(/#$/) := r) : "Patterns list contains pattern(s) outside repository"; // Test behavioral properties of the TextMate grammar - + loc lProject = |project://rascal-textmate-core|; loc lGrammar = lProject + "/target/generated-test-grammars/.tmLanguage.json"; toJSON(tm, l = resolveLocation(lGrammar)); @@ -83,10 +83,16 @@ bool doTransformTest(list[ConversionUnit] units, RepositoryStats expect, str nam } elseif (!exists(lTester)) { println("[LOG] No tokenizer available (`` does not exist)"); } else { - bool windows = startsWith(getSystemProperty("os.name"), "Windows"); - loc lExec = lProject + "/src/test/sh/lang/textmate/conversion-tests."; - - if ( := execWithCode(lExec, args = [name]) && exitCode != 0) { + bool windows = startsWith(getSystemProperty("os.name"), "Windows"); + loc lExec = |PATH:///npx|; + list[str] args = [ + "vscode-tmgrammar-test", + "--grammar", + resolveLocation(lGrammar).path[(windows ? 1 : 0)..], + resolveLocation(lTest).path[(windows ? 1 : 0)..] + ]; + + if ( := execWithCode(lExec, args = args) && exitCode != 0) { println(output); assert false : "Actual tokenization does not match expected tokenization (see output above for details)"; }