cangjie-unittest

Write and run Cangjie unit tests with assertions, mocking, and verification.

2|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/zhenzhizhi12/NexusAgent --skill cangjie-unittest-zhenzhizhi12
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cangjie-unittest
Source: https://github.com/zhenzhizhi12/NexusAgent/tree/main/.opencode/skills/common-skill-l1/unittest
Command: npx skills add https://github.com/zhenzhizhi12/NexusAgent --skill cangjie-unittest-zhenzhizhi12

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive tools and guidance for writing, running, and managing unit tests for Cangjie language code, ensuring code quality and reliability.

Core Features & Use Cases

  • Test Definition: Supports various test entities like test functions, test classes, and parameterized tests.
  • Assertion Library: Offers a rich set of assertion macros for checking conditions, expected outcomes, and exceptions, including power assertions for detailed failure analysis.
  • Mocking & Verification: Includes a robust mocking framework for isolating code under test and verifying interactions.
  • Use Case: When developing a new feature in Cangjie, use this Skill to write unit tests that cover different scenarios, mock external dependencies, and verify that the feature behaves as expected before integration.

Quick Start

Run all unit tests for your Cangjie project using the cjpm test command.

Frequently Asked Questions about cangjie-unittest

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write unit tests for Cangjie language code?

To write unit tests for Cangjie language code, you define test entities using `@Test` and `@TestCase`, implement assertions with `@Expect` and `@Assert`, and isolate dependencies using `@On` and `Verify` macros.

Can I run parameterized and benchmark tests in a Cangjie testing framework?

Yes, the Cangjie testing framework supports advanced patterns including parameterization, benchmarking, and dynamic test generation to verify code behavior across multiple scenarios and performance metrics.

How do I mock external dependencies when testing Cangjie modules?

You can mock external dependencies in Cangjie modules using the built-in mocking framework, utilizing `@On` to setup mocks and `Verify` to confirm interactions, ensuring isolated and reliable test execution.

What is the best way to execute all unit tests in a Cangjie project?

The best way to execute all unit tests in a Cangjie project is by running the `cjpm test` command, which automatically discovers and runs your defined test cases and reports assertion results.

Does Cangjie support detailed failure analysis for unit test assertions?

Yes, Cangjie supports detailed failure analysis through power assertions, providing comprehensive diagnostic information when `@Expect` or `@Assert` conditions fail during unit test execution.

When do I need to use the `@TestCase` annotation in Cangjie testing?

You need to use the `@TestCase` annotation in Cangjie testing when structuring complex test scenarios into test classes, allowing you to group related test functions and share setup logic across multiple assertions.