Skip to content

Commit

Permalink
[compiler][fixtures] Repro for fbt + non-ascii strings
Browse files Browse the repository at this point in the history
ghstack-source-id: 05211980566f8c061ac2ca8ce51e442d234beacc
Pull Request resolved: #30386
  • Loading branch information
mofeiZ committed Jul 18, 2024
1 parent e15c5b1 commit 378ab81
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

## Input

```javascript
import fbt from "fbt";

function Component(props) {
const element = (
<fbt desc={"Dialog to show to user"}>
Hello{" "}
<fbt:param
name="a really long description
that got split into multiple lines"
>
{props.name}
</fbt:param>
</fbt>
);
return element.toString();
}

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ name: "Jason" }],
};

```


## Error

```
Cannot read properties of undefined (reading 'replace')
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import fbt from "fbt";

function Component(props) {
const element = (
<fbt desc={"Dialog to show to user"}>
Hello{" "}
<fbt:param
name="a really long description
that got split into multiple lines"
>
{props.name}
</fbt:param>
</fbt>
);
return element.toString();
}

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ name: "Jason" }],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

## Input

```javascript
import fbt from "fbt";

function Component(props) {
const element = (
<fbt desc={"Dialog to show to user"}>
Hello <fbt:param name='"user" name'>{props.name}</fbt:param>
</fbt>
);
return element.toString();
}

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ name: "Jason" }],
};

```


## Error

```
Property arguments[0] of CallExpression expected node to be of a type ["Expression","SpreadElement","JSXNamespacedName","ArgumentPlaceholder"] but instead got "JSXExpressionContainer"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import fbt from "fbt";

function Component(props) {
const element = (
<fbt desc={"Dialog to show to user"}>
Hello <fbt:param name='"user" name'>{props.name}</fbt:param>
</fbt>
);
return element.toString();
}

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ name: "Jason" }],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

## Input

```javascript
import fbt from "fbt";

function Component(props) {
const element = (
<fbt desc={"Dialog to show to user"}>
Hello <fbt:param name="user name ☺">{props.name}</fbt:param>
</fbt>
);
return element.toString();
}

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ name: "Jason" }],
};

```


## Error

```
Property arguments[0] of CallExpression expected node to be of a type ["Expression","SpreadElement","JSXNamespacedName","ArgumentPlaceholder"] but instead got "JSXExpressionContainer"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import fbt from "fbt";

function Component(props) {
const element = (
<fbt desc={"Dialog to show to user"}>
Hello <fbt:param name="user name ☺">{props.name}</fbt:param>
</fbt>
);
return element.toString();
}

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ name: "Jason" }],
};

0 comments on commit 378ab81

Please sign in to comment.