forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add e2e tests skeleton for generated cpp code (facebook#25673)
Summary: Pull Request resolved: facebook#25673 This diff add e2e code generator validation. I added proper buck rule which compiles cpp code and test if it really compiles. While testing I faced few minor issues: - `getBool` and `getNumber` shouldn't have `rt` param. - Generators now start considering whole module name instead of sliced part of their name. - Fixed import structure in generated cpp. - renamed `jsireact` to `ReactCommon` following D16231697 Reviewed By: rickhanlonii Differential Revision: D16221277 fbshipit-source-id: aff4011ad52dd5e16546ffdb709d6a751ebfaced
- Loading branch information
1 parent
83969c2
commit d672247
Showing
11 changed files
with
206 additions
and
125 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
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
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
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
34 changes: 34 additions & 0 deletions
34
packages/react-native-codegen/e2e/__test_fixtures__/NativeSampleTurboModule.js
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,34 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
* @format | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; | ||
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; | ||
|
||
export interface Spec extends TurboModule { | ||
// Exported methods. | ||
+getConstants: () => {| | ||
const1: boolean, | ||
const2: number, | ||
const3: string, | ||
|}; | ||
+voidFunc: () => void; | ||
+getBool: (arg: boolean) => boolean; | ||
+getNumber: (arg: number) => number; | ||
+getString: (arg: string) => string; | ||
+getArray: (arg: Array<any>) => Array<any>; | ||
+getObject: (arg: Object) => Object; | ||
+getValue: (x: number, y: string, z: Object) => Object; | ||
+getValueWithCallback: (callback: (value: string) => void) => void; | ||
+getValueWithPromise: (error: boolean) => Promise<string>; | ||
} | ||
|
||
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule'); |
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
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
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
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
Oops, something went wrong.