Test Suite Overview

Language-Agnostic Test Specifications - These test specifications are designed to be implemented consistently across all language implementations of TON.

Purpose

This comprehensive test suite ensures consistent behavior across all TON implementations. Each test category validates specific aspects of the TON specification, providing clear input/output expectations that can be replicated in any programming language.

Test Categories

1. Lexer Tests

Validates tokenization of TON source text into discrete tokens.

2. Parser Tests

Validates construction of abstract syntax tree from tokens.

3. Serializer Tests

Validates conversion of object model back to TON text format.

4. Validator Tests

Validates schema enforcement and constraint checking.

5. Array Tests

Validates array parsing, serialization, and validation.

6. Edge Case Tests

Validates handling of boundary conditions and error scenarios.

7. Integration Tests

End-to-end testing of complete workflows and component interactions.

8. Multi-line String Tests

Tests for triple-quoted multi-line string literals and indentation handling.

9. Path-Based Schema Tests

Validation of path-based property schemas and nested validation rules.

10. Formatter Tests

Document formatting and style transformation capabilities.

11. Numeric Property Tests

Handling of numeric and alphanumeric property names.

Test Structure Format

Each test specification follows this consistent format:

Test ID: [Category]_[TestNumber]
Test Name: [Descriptive name]
Purpose: [What aspect is being tested]

Input:
[Exact TON input or object structure]

Expected Output/Behavior:
[Exact expected result or behavior]

Validation Points:
- [Specific assertion 1]
- [Specific assertion 2]
- [etc.]

Implementation Guidelines

For Test Implementers

  1. Exact Replication: Test inputs and expected outputs must be replicated exactly as specified
  2. No Assumptions: Do not make assumptions about behavior not explicitly stated
  3. Complete Coverage: All test cases in a category must be implemented
  4. Clear Reporting: Test failures should clearly indicate which specification was not met

Test Execution Order

While tests should be independent, the recommended execution order is:

  1. Lexer Tests (foundational)
  2. Parser Tests (builds on lexer)
  3. Multi-line String Tests (lexer feature)
  4. Numeric Property Tests (parser feature)
  5. Array Tests (specific feature)
  6. Serializer Tests (validates output)
  7. Formatter Tests (formatting styles)
  8. Validator Tests (schema enforcement)
  9. Path-Based Schema Tests (advanced validation)
  10. Edge Case Tests (error handling)
  11. Integration Tests (end-to-end)

Conformance Levels

Tests are grouped by conformance level:

  • Level 1 (Basic): Core functionality tests
  • Level 2 (Standard): Complete literal and type support
  • Level 3 (Full): All features including advanced validation

See Conformance Levels for detailed requirements.