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 ad7dd56
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/typescript/src/generators/dart.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 {dartGenerator, DartGenerator, Order} from 'blockly-test/dart';

Check failure on line 13 in tests/typescript/src/generators/dart.ts

View workflow job for this annotation

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

Module '"blockly-test/dart"' has no exported member 'dartGenerator'.

Check failure on line 13 in tests/typescript/src/generators/dart.ts

View workflow job for this annotation

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

Module '"blockly-test/dart"' has no exported member 'DartGenerator'.

Check failure on line 13 in tests/typescript/src/generators/dart.ts

View workflow job for this annotation

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

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

Check failure on line 13 in tests/typescript/src/generators/dart.ts

View workflow job for this annotation

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

Module '"blockly-test/dart"' has no exported member 'dartGenerator'.

Check failure on line 13 in tests/typescript/src/generators/dart.ts

View workflow job for this annotation

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

Module '"blockly-test/dart"' has no exported member 'DartGenerator'.

Check failure on line 13 in tests/typescript/src/generators/dart.ts

View workflow job for this annotation

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

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

/**
* 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,
_generator: DartGenerator,
): [string, Order] {
return ['42', Order.ATOMIC];
};
28 changes: 28 additions & 0 deletions tests/typescript/src/generators/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/generators/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/generators/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/generators/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/generators/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,
} 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,
_generator: JavascriptGenerator,
): [string, Order] {
return ['42', Order.ATOMIC];
};
24 changes: 24 additions & 0 deletions tests/typescript/src/generators/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/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,
_generator: LuaGenerator,
): [string, Order] {
return ['42', Order.ATOMIC];
};
24 changes: 24 additions & 0 deletions tests/typescript/src/generators/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/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,
_generator: PhpGenerator,
): [string, Order] {
return ['42', Order.ATOMIC];
};
24 changes: 24 additions & 0 deletions tests/typescript/src/generators/python.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 {pythonGenerator, PythonGenerator, Order} from 'blockly-test/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,
_generator: PythonGenerator,
): [string, Order] {
return ['42', Order.ATOMIC];
};

0 comments on commit ad7dd56

Please sign in to comment.