From ea7c306e80a0b3628258b05ad7f503fd73ce00ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20M=C3=BCller?= Date: Mon, 6 Nov 2023 11:37:19 +0100 Subject: [PATCH] Applied new TestExtension loading --- .../src/archive-interpreter-executor.spec.ts | 12 ++++------ .../std/exec/src/file-picker-executor.spec.ts | 12 ++++------ .../src/gtfs-rt-interpreter-executor.spec.ts | 12 ++++------ .../exec/src/http-extractor-executor.spec.ts | 12 ++++------ .../text-file-interpreter-executor.spec.ts | 12 ++++------ .../src/text-line-deleter-executor.spec.ts | 12 ++++------ .../src/text-range-selector-executor.spec.ts | 12 ++++------ .../test/test-extension/TestBlockTypes.jv | 23 +++++++++++++++++++ 8 files changed, 58 insertions(+), 49 deletions(-) create mode 100644 libs/extensions/std/exec/test/test-extension/TestBlockTypes.jv diff --git a/libs/extensions/std/exec/src/archive-interpreter-executor.spec.ts b/libs/extensions/std/exec/src/archive-interpreter-executor.spec.ts index 060b52aba..7b174ae11 100644 --- a/libs/extensions/std/exec/src/archive-interpreter-executor.spec.ts +++ b/libs/extensions/std/exec/src/archive-interpreter-executor.spec.ts @@ -6,17 +6,15 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; -import { StdLangExtension } from '@jvalue/jayvee-extensions/std/lang'; import { BlockDefinition, IOType, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -67,12 +65,12 @@ describe('Validation of ArchiveInterpreterExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new StdLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/std/exec/src/file-picker-executor.spec.ts b/libs/extensions/std/exec/src/file-picker-executor.spec.ts index e4d49c698..8fd8e3578 100644 --- a/libs/extensions/std/exec/src/file-picker-executor.spec.ts +++ b/libs/extensions/std/exec/src/file-picker-executor.spec.ts @@ -6,17 +6,15 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; -import { StdLangExtension } from '@jvalue/jayvee-extensions/std/lang'; import { BlockDefinition, IOType, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -71,12 +69,12 @@ describe('Validation of FilePickerExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new StdLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/std/exec/src/gtfs-rt-interpreter-executor.spec.ts b/libs/extensions/std/exec/src/gtfs-rt-interpreter-executor.spec.ts index 12d3dc689..75d8ae8d9 100644 --- a/libs/extensions/std/exec/src/gtfs-rt-interpreter-executor.spec.ts +++ b/libs/extensions/std/exec/src/gtfs-rt-interpreter-executor.spec.ts @@ -6,17 +6,15 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; -import { StdLangExtension } from '@jvalue/jayvee-extensions/std/lang'; import { BlockDefinition, IOType, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -67,12 +65,12 @@ describe('Validation of GtfsRTInterpreterExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new StdLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/std/exec/src/http-extractor-executor.spec.ts b/libs/extensions/std/exec/src/http-extractor-executor.spec.ts index cd680792f..7bccbb58d 100644 --- a/libs/extensions/std/exec/src/http-extractor-executor.spec.ts +++ b/libs/extensions/std/exec/src/http-extractor-executor.spec.ts @@ -6,17 +6,15 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; -import { StdLangExtension } from '@jvalue/jayvee-extensions/std/lang'; import { BlockDefinition, IOType, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -56,12 +54,12 @@ describe('Validation of HttpExtractorExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new StdLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/std/exec/src/text-file-interpreter-executor.spec.ts b/libs/extensions/std/exec/src/text-file-interpreter-executor.spec.ts index c477fb9e3..342bceeab 100644 --- a/libs/extensions/std/exec/src/text-file-interpreter-executor.spec.ts +++ b/libs/extensions/std/exec/src/text-file-interpreter-executor.spec.ts @@ -6,17 +6,15 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; -import { StdLangExtension } from '@jvalue/jayvee-extensions/std/lang'; import { BlockDefinition, IOType, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -67,12 +65,12 @@ describe('Validation of TextFileInterpreterExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new StdLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/std/exec/src/text-line-deleter-executor.spec.ts b/libs/extensions/std/exec/src/text-line-deleter-executor.spec.ts index 3ae786cb2..8ca8a191e 100644 --- a/libs/extensions/std/exec/src/text-line-deleter-executor.spec.ts +++ b/libs/extensions/std/exec/src/text-line-deleter-executor.spec.ts @@ -6,17 +6,15 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; -import { StdLangExtension } from '@jvalue/jayvee-extensions/std/lang'; import { BlockDefinition, IOType, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -67,12 +65,12 @@ describe('Validation of TextLineDeleterExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new StdLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/std/exec/src/text-range-selector-executor.spec.ts b/libs/extensions/std/exec/src/text-range-selector-executor.spec.ts index e5e534533..73e333359 100644 --- a/libs/extensions/std/exec/src/text-range-selector-executor.spec.ts +++ b/libs/extensions/std/exec/src/text-range-selector-executor.spec.ts @@ -6,17 +6,15 @@ import * as path from 'path'; import * as R from '@jvalue/jayvee-execution'; import { getTestExecutionContext } from '@jvalue/jayvee-execution/test'; -import { StdLangExtension } from '@jvalue/jayvee-extensions/std/lang'; import { BlockDefinition, IOType, createJayveeServices, - useExtension, } from '@jvalue/jayvee-language-server'; import { ParseHelperOptions, - TestLangExtension, expectNoParserAndLexerErrors, + loadTestExtensions, parseHelper, readJvTestAssetHelper, } from '@jvalue/jayvee-language-server/test'; @@ -67,12 +65,12 @@ describe('Validation of TextRangeSelectorExecutor', () => { ); } - beforeAll(() => { - // Register extensions - useExtension(new StdLangExtension()); - useExtension(new TestLangExtension()); + beforeAll(async () => { // Create language services const services = createJayveeServices(NodeFileSystem).Jayvee; + await loadTestExtensions(services, [ + path.resolve(__dirname, '../test/test-extension/TestBlockTypes.jv'), + ]); locator = services.workspace.AstNodeLocator; // Parse function for Jayvee (without validation) parse = parseHelper(services); diff --git a/libs/extensions/std/exec/test/test-extension/TestBlockTypes.jv b/libs/extensions/std/exec/test/test-extension/TestBlockTypes.jv new file mode 100644 index 000000000..3abfdb4e2 --- /dev/null +++ b/libs/extensions/std/exec/test/test-extension/TestBlockTypes.jv @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2023 Friedrich-Alexander-Universitat Erlangen-Nurnberg +// +// SPDX-License-Identifier: AGPL-3.0-only + +builtin blocktype TestFileExtractor { + input inPort oftype None; + output outPort oftype File; +} + +builtin blocktype TestFileLoader { + input inPort oftype File; + output outPort oftype None; +} + +builtin blocktype TestSheetLoader { + input inPort oftype Sheet; + output outPort oftype None; +} + +builtin blocktype TestTextFileLoader { + input inPort oftype TextFile; + output outPort oftype None; +}