From bfa0aa2813a03ffc98dd8ec4b602bac77d6cde97 Mon Sep 17 00:00:00 2001 From: Mofei Zhang Date: Mon, 11 Dec 2023 22:59:33 -0500 Subject: [PATCH] [be][test] use mutateAndReturn in test to render more values --- .../fixtures/compiler/for-of-mutate.expect.md | 22 ++++++++++++++----- .../fixtures/compiler/for-of-mutate.tsx | 10 +++++++-- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-of-mutate.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-of-mutate.expect.md index b8f2119121..2f1ac586e1 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-of-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-of-mutate.expect.md @@ -2,13 +2,19 @@ ## Input ```javascript -import { makeObject_Primitives, mutate, Stringify } from "shared-runtime"; +import { + makeObject_Primitives, + mutateAndReturn, + Stringify, +} from "shared-runtime"; function Component(_props) { const collection = [makeObject_Primitives()]; const results = []; for (const item of collection) { - results.push(
{Stringify(mutate(item))}
); + results.push( +
{Stringify(mutateAndReturn(item))}
+ ); } return
{results}
; } @@ -25,7 +31,11 @@ export const FIXTURE_ENTRYPOINT = { ```javascript import { unstable_useMemoCache as useMemoCache } from "react"; -import { makeObject_Primitives, mutate, Stringify } from "shared-runtime"; +import { + makeObject_Primitives, + mutateAndReturn, + Stringify, +} from "shared-runtime"; function Component(_props) { const $ = useMemoCache(1); @@ -34,7 +44,9 @@ function Component(_props) { const collection = [makeObject_Primitives()]; const results = []; for (const item of collection) { - results.push(
{Stringify(mutate(item))}
); + results.push( +
{Stringify(mutateAndReturn(item))}
+ ); } t0 =
{results}
; @@ -54,4 +66,4 @@ export const FIXTURE_ENTRYPOINT = { ``` ### Eval output -(kind: ok)
\ No newline at end of file +(kind: ok)
{"a":0,"b":"value1","c":true,"wat0":"joe"}
\ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-of-mutate.tsx b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-of-mutate.tsx index 394c8754db..6c5ad7dc66 100644 --- a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-of-mutate.tsx +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/for-of-mutate.tsx @@ -1,10 +1,16 @@ -import { makeObject_Primitives, mutate, Stringify } from "shared-runtime"; +import { + makeObject_Primitives, + mutateAndReturn, + Stringify, +} from "shared-runtime"; function Component(_props) { const collection = [makeObject_Primitives()]; const results = []; for (const item of collection) { - results.push(
{Stringify(mutate(item))}
); + results.push( +
{Stringify(mutateAndReturn(item))}
+ ); } return
{results}
; }