Kết xuấtvi

tất_cả

Translation status: Tiếng Việt reader-locale proof. Term names and code fences follow the vi pack; supporting prose may still be English.

Marks a test hook as applying to every case.

Syntax: tất_cả

Category#

testing

Examples#

radix/corpus/omnia/omnia.fab (canonical · keyword)#

Marks a test hook as applying to every case.

# =============================================================================
# tất_cả — Marks a test hook as applying to every case.
# =============================================================================
#
# What this teaches:
#   • Exhaustive matching — `phân_tích tất_cả` requires every variant of a `hợp_nhất` to have a `trường_hợp` branch.
#   • Safety guarantee — The compiler rejects incomplete matches, eliminating forgotten variant bugs.
#
# Common mistakes:
#   • Using mặc_định with phân_tích tất_cả — tất_cả forbids catchall arms; list every variant explicitly.
#
# See also: chuẩn_bị, sau_chuẩn_bị
# =============================================================================

# tất_cả — exhaustive phân_tích (must cover every variant)
#
# phân_tích tất_cả <hợp_nhất> { trường_hợp <Variant> { … } … }
#
# GRAMMAR:
#   matchStmt :← 'phân_tích' 'tất_cả' expr '{' casuClause* '}'
#
# EXPECTED OUTPUT:
#   none — stdout not pinned for this exemplum.

union Condicio {
    Activa,
    Quietus
}

fn narra(Condicio condicio) → string {
    # every variant must have a trường_hợp
    match all condicio {
        case Activa {
            return "activa"
        }
        case Quietus {
            return "quietus"
        }
    }
}

main {
    const Condicio condicio ← variant Activa
    print narra(condicio)
}

Expected output:

activa