Skip to content

Commit

Permalink
test(generators): Add generator TS import/use tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcallen committed Jan 8, 2024
1 parent 2a20a3a commit ad14bf7
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/typescript/src/generator/dart.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @license
* Copyright 2024 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import * as Blockly from 'blockly-test/core';

/**
* Test: should be able to import a generator instance, class, and
* Order enum.
*/
import {
dartGenerator,
DartGenerator,
Order,
} from 'blockly-test/generators/dart';

/**
* Test: should be able to create a simple block generator function,
* correctly typed, and insert it into the .forBlock dictionary.
*/
dartGenerator.forBlock['the_answer'] = function (
block: Blockly.Block,

Check failure on line 24 in tests/typescript/src/generator/dart.ts

View workflow job for this annotation

GitHub Actions / lint

'block' is defined but never used. Allowed unused args must match /^_/u
generator: DartGenerator,

Check failure on line 25 in tests/typescript/src/generator/dart.ts

View workflow job for this annotation

GitHub Actions / lint

'generator' is defined but never used. Allowed unused args must match /^_/u
): [string, Order] {
return ['42', Order.ATOMIC];
};
28 changes: 28 additions & 0 deletions tests/typescript/src/generator/javascript.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @license
* Copyright 2024 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import * as Blockly from 'blockly-test/core';

/**
* Test: should be able to import a generator instance, class, and
* Order enum.
*/
import {
javascriptGenerator,

Check failure on line 14 in tests/typescript/src/generator/javascript.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18.x)

Module '"blockly-test/javascript"' has no exported member 'javascriptGenerator'.

Check failure on line 14 in tests/typescript/src/generator/javascript.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20.x)

Module '"blockly-test/javascript"' has no exported member 'javascriptGenerator'.
JavascriptGenerator,

Check failure on line 15 in tests/typescript/src/generator/javascript.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18.x)

Module '"blockly-test/javascript"' has no exported member 'JavascriptGenerator'.

Check failure on line 15 in tests/typescript/src/generator/javascript.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20.x)

Module '"blockly-test/javascript"' has no exported member 'JavascriptGenerator'.
Order,

Check failure on line 16 in tests/typescript/src/generator/javascript.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18.x)

Module '"blockly-test/javascript"' has no exported member 'Order'.

Check failure on line 16 in tests/typescript/src/generator/javascript.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20.x)

Module '"blockly-test/javascript"' has no exported member 'Order'.
} from 'blockly-test/javascript';

/**
* Test: should be able to create a simple block generator function,
* correctly typed, and insert it into the .forBlock dictionary.
*/
javascriptGenerator.forBlock['the_answer'] = function (
block: Blockly.Block,

Check failure on line 24 in tests/typescript/src/generator/javascript.ts

View workflow job for this annotation

GitHub Actions / lint

'block' is defined but never used. Allowed unused args must match /^_/u
generator: JavascriptGenerator,

Check failure on line 25 in tests/typescript/src/generator/javascript.ts

View workflow job for this annotation

GitHub Actions / lint

'generator' is defined but never used. Allowed unused args must match /^_/u
): [string, Order] {
return ['42', Order.ATOMIC];
};
24 changes: 24 additions & 0 deletions tests/typescript/src/generator/lua.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @license
* Copyright 2024 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import * as Blockly from 'blockly-test/core';

/**
* Test: should be able to import a generator instance, class, and
* Order enum.
*/
import {luaGenerator, LuaGenerator, Order} from 'blockly-test/generators/lua';

/**
* Test: should be able to create a simple block generator function,
* correctly typed, and insert it into the .forBlock dictionary.
*/
luaGenerator.forBlock['the_answer'] = function (
block: Blockly.Block,

Check failure on line 20 in tests/typescript/src/generator/lua.ts

View workflow job for this annotation

GitHub Actions / lint

'block' is defined but never used. Allowed unused args must match /^_/u
generator: LuaGenerator,

Check failure on line 21 in tests/typescript/src/generator/lua.ts

View workflow job for this annotation

GitHub Actions / lint

'generator' is defined but never used. Allowed unused args must match /^_/u
): [string, Order] {
return ['42', Order.ATOMIC];
};
24 changes: 24 additions & 0 deletions tests/typescript/src/generator/php.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @license
* Copyright 2024 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import * as Blockly from 'blockly-test/core';

/**
* Test: should be able to import a generator instance, class, and
* Order enum.
*/
import {phpGenerator, PhpGenerator, Order} from 'blockly-test/generators/php';

/**
* Test: should be able to create a simple block generator function,
* correctly typed, and insert it into the .forBlock dictionary.
*/
phpGenerator.forBlock['the_answer'] = function (
block: Blockly.Block,

Check failure on line 20 in tests/typescript/src/generator/php.ts

View workflow job for this annotation

GitHub Actions / lint

'block' is defined but never used. Allowed unused args must match /^_/u
generator: PhpGenerator,

Check failure on line 21 in tests/typescript/src/generator/php.ts

View workflow job for this annotation

GitHub Actions / lint

'generator' is defined but never used. Allowed unused args must match /^_/u
): [string, Order] {
return ['42', Order.ATOMIC];
};
28 changes: 28 additions & 0 deletions tests/typescript/src/generator/python.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @license
* Copyright 2024 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import * as Blockly from 'blockly-test/core';

/**
* Test: should be able to import a generator instance, class, and
* Order enum.
*/
import {
pythonGenerator,
PythonGenerator,
Order,
} from 'blockly-test/generators/python';

/**
* Test: should be able to create a simple block generator function,
* correctly typed, and insert it into the .forBlock dictionary.
*/
pythonGenerator.forBlock['the_answer'] = function (
block: Blockly.Block,

Check failure on line 24 in tests/typescript/src/generator/python.ts

View workflow job for this annotation

GitHub Actions / lint

'block' is defined but never used. Allowed unused args must match /^_/u
generator: PythonGenerator,

Check failure on line 25 in tests/typescript/src/generator/python.ts

View workflow job for this annotation

GitHub Actions / lint

'generator' is defined but never used. Allowed unused args must match /^_/u
): [string, Order] {
return ['42', Order.ATOMIC];
};

0 comments on commit ad14bf7

Please sign in to comment.