-
Notifications
You must be signed in to change notification settings - Fork 4
feat(ut): add unittest framework assembly code to repo #310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR integrates a lightweight AssemblyScript-based unit test framework into the warpo_extension tree and wires it into the existing assemblyscript-unittest-framework setup. It adds core assertion/mocking utilities, environment bindings, and a comprehensive test suite exercising equality, formatting, and mocking behavior for the Warpo extensions.
Changes:
- Introduces a
warpo/std/warpo/testruntime helper library (expectations, comparison helpers, formatting, mocking, and env bindings) that delegates to the external unittest framework environment. - Adds Warpo-specific AssemblyScript tests under
tests/warpo_extensionto validate the new equality helpers, formatting logic, and function mocking behavior (including call_indirect and default params). - Updates
as-test.config.jsand test TypeScript configuration to include the new Warpo extension test sources in the test runner.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
warpo_extension/std/warpo/test/mockInstrument.ts |
Declares externs for mock function control and wraps them in a MockFn helper used by the mocking API. |
warpo_extension/std/warpo/test/index.ts |
Exposes the public testing API (describe, test, lifecycle hooks, mock/unmock/remock, and expect) backed by the internal implementations. |
warpo_extension/std/warpo/test/index.d.ts |
Adds an (currently empty) declaration stub alongside the new test module, presumably for future type surface alignment. |
warpo_extension/std/warpo/test/implement.ts |
Implements core test orchestration and mocking behavior, wiring test and hook functions into the external env and managing mock registration and ignore flags. |
warpo_extension/std/warpo/test/formatPrint.ts |
Implements toJson pretty-printing for a variety of primitive, array/typed-array, ArrayBuffer, Set, Map, and generic object values for assertion messages. |
warpo_extension/std/warpo/test/expect.ts |
Implements the Value<T> expectation API (relational operators, null checks, equality, approximate equality, and type identity checks) and forwards results to the external assertion collector. |
warpo_extension/std/warpo/test/env.ts |
Binds to the __unittest_framework_env imports for description management, test registration, lifecycle hooks, and result collection. |
warpo_extension/std/warpo/test/comparison.ts |
Provides deep equality helpers for nullable references, ArrayBuffer, array-like containers, Map, and Set, plus a generic equal<T> predicate used by expect. |
tests/warpo_extension/warpo/test/mockBaseFunc.ts |
Defines simple functions and a class used as fixtures in the mocking tests (direct calls, call_indirect patterns, default parameters, and method callbacks). |
tests/warpo_extension/warpo/test/mock.test.ts |
Adds tests covering the mocking API, including call counts, unmock/remock behavior, call_indirect usage, class method mocking, and functions with default parameters. |
tests/warpo_extension/warpo/test/format.test.ts |
Adds tests validating toJson behavior for arrays, ArrayBuffer, Set, Map, nullable values, booleans, strings (including control codes and unicode), and user-defined classes. |
tests/warpo_extension/warpo/test/expect.test.ts |
Adds tests for the expectation API, covering numeric comparisons, null/notNull, .not inversion, inheritance-aware isa, and isExactly for nullable and non-nullable references. |
tests/warpo_extension/warpo/test/comparison.test.ts |
Adds extensive tests for the deep equality helpers across base types, arrays and typed arrays, maps, sets, nullable collections, and nested multi-level container structures. |
tests/warpo_extension/tsconfig.json |
Configures TypeScript compilation for the new Warpo extension tests by extending the shared Warpo TS config. |
as-test.config.js |
Extends the unittest framework configuration to include Warpo extension sources and tests, and to use a recursive glob for AssemblyScript source files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.