From 84d5b11f126cacf66de38fe7bddedb9858a048bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Piquemal?= Date: Fri, 18 Oct 2024 23:34:49 +0200 Subject: [PATCH] minor changes --- src/functional-helpers.test.ts | 7 ++++++- src/index.ts | 2 +- src/run/index.ts | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/functional-helpers.test.ts b/src/functional-helpers.test.ts index 4cf021c..f4b9777 100644 --- a/src/functional-helpers.test.ts +++ b/src/functional-helpers.test.ts @@ -19,7 +19,7 @@ */ import assert from 'assert' -import { countTo } from './functional-helpers' +import { countTo, renderSwitch } from './functional-helpers' describe('functional-helpers', () => { describe('countTo', () => { @@ -27,4 +27,9 @@ describe('functional-helpers', () => { assert.deepStrictEqual(countTo(3), [0, 1, 2]) }) }) + describe('renderSwitch', () => { + it('should render the first route that matches the test', () => { + assert.strictEqual(renderSwitch([false, 'bli'], [true, 'bla'], [true, 'foo']), 'bla') + }) + }) }) diff --git a/src/index.ts b/src/index.ts index 7aa57b8..2dd252b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -30,7 +30,7 @@ export { FS_OPERATION_SUCCESS, FS_OPERATION_FAILURE, } from './stdlib/fs/constants' -export { Engine, Message, MessageToken, FloatArray } from './run/types' +export { Engine, EngineMetadata, Message, MessageToken, FloatArray } from './run/types' export { createEngine as createAssemblyScriptWasmEngine } from './engine-assemblyscript/run' export { createEngine as createJavaScriptEngine } from './engine-javascript/run' export { readMetadata } from './run' diff --git a/src/run/index.ts b/src/run/index.ts index 898a5a9..f983187 100644 --- a/src/run/index.ts +++ b/src/run/index.ts @@ -17,11 +17,10 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -import { CompilerTarget, VariableNamesIndex } from '../compile/types' +import { CompilerTarget } from '../compile/types' import { readMetadata as readMetadataWasm } from '../engine-assemblyscript/run/metadata' import { JavaScriptEngineCode } from '../engine-javascript/compile/types' import { createEngine } from '../engine-javascript/run' -import { proxyWithNameMapping } from './run-helpers' import { EngineMetadata } from './types' export const readMetadata = async (