-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(generators): Add generator TS import/use tests
- Loading branch information
Showing
5 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
generator: DartGenerator, | ||
): [string, Order] { | ||
return ['42', Order.ATOMIC]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 GitHub Actions / build (ubuntu-latest, 18.x)
|
||
JavascriptGenerator, | ||
Check failure on line 15 in tests/typescript/src/generator/javascript.ts GitHub Actions / build (ubuntu-latest, 18.x)
|
||
Order, | ||
Check failure on line 16 in tests/typescript/src/generator/javascript.ts GitHub Actions / build (ubuntu-latest, 18.x)
|
||
} 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]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
generator: LuaGenerator, | ||
): [string, Order] { | ||
return ['42', Order.ATOMIC]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
generator: PhpGenerator, | ||
): [string, Order] { | ||
return ['42', Order.ATOMIC]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
generator: PythonGenerator, | ||
): [string, Order] { | ||
return ['42', Order.ATOMIC]; | ||
}; |