#!/usr/bin/env bats # Unit -- story 002, Task 3.2: the `--vectors` mode. # Requirements: R5.1, R5.2, R5.3, R5.4, R5.5, R5.6, R7.4. # # Contract (design.md C4, "Error Handling Strategy"): `--vectors` runs # `--static` first (a failing static is exit 1 with its report, nothing # compared), then runs every vector through the --compose code path: a valid # vector agrees when --compose accepts and prints exactly its `parent` lines # in order; an invalid one agrees when --compose rejects and the SET of rule # names it reports equals `rules`, in any order. Each disagreement is one line # `vector : expected ..., --compose gave ...`; every one is reported, # then exit 1. It never reads /var/db/repos/gentoo nor calls Portage. # # Comparison is identity, so both hostile halves are here: two lists with the # same content in another order must NOT agree for `parent` (order is the # contract), and two rule lists with the same members in another order, or # with a rule --compose prints twice, MUST agree for `rules` (a set). load lib/fixture load lib/vectors-fixture # --- R5.3: rules compare as a set (hostile halves first) ------------------------- @test "R5.3 hostile: rules listed in another order than --compose prints them (base, exclusive) agree: exit 0" { vfx_catalog vfx_vectors two-rules-flavors-on-desktop # --compose prints exclusive first, then base once PER constrained layer # (server and headless): as a set that is {exclusive, base} vfx_vec_raw < 1 && !/^#/ { exit } { print }' "$SCRIPT") grep -qE '^#[[:space:]]+--vectors' <<<"$header" || { echo "the header's mode list does not name --vectors" >&2 false } }