1
0
Fork 0
gobject-generator/smoke/tier6/SoupSmoke.swift
Brendan Szymanski 525aefa7aa Complete Phase E5 tier-6 Adw/Soup/Gst compile-gate compliance
Relaxes the generated-filename PascalCase validator's uppercase-run cap
(>3 -> >4) so legitimate acronym type names (PluginAPIFlags, AuthNTLM)
stop crashing generation.

Fixes four compounding cross-module correctness bugs the larger tier-6
GIR set exposed at scale:
- The duplicate-of-dependency drop only checked simple-name collision,
  wrongly dropping genuinely distinct C types that merely share a
  post-namespace-stripping Swift name (Gst.Object/GstObject vs
  GObject.Object/GObject, plus three tier-4/5 cases: Gdk.AppLaunchContext,
  Gdk.Gravity, Gdk.Rectangle). Now also requires matching cType.
- Qualifying a cross-module reference as "GObject.X" broke wherever a
  raw C struct also named GObject was in scope (every C target's import),
  since Swift resolved the module name to the shadowing struct. GObject's
  Support.swift now exports collision-free GLibObject/GLibValueArray
  aliases used instead.
- Missing `override` keyword: added ancestor-method-selector detection
  (name + parameter labels, same-module only, since none of these members
  are open) so a subclass narrowing an ancestor's return type compiles.
- The pre-existing cross-module inherited-member dedup pass keyed
  ancestors by bare Swift name; its cycle guard falsely self-terminated
  once two classes shared a name, missing real inherited members (e.g.
  GstObject's own ref()/unref() were never recognized as duplicating
  GObject.Object's, producing an illegal redeclaration). Rewired to walk
  by unambiguous GIR name via new ClassPlan.girName/parentGIRName fields.

Also fixes bitfield/enum-typed global constants (wraps the raw literal
in Type(rawValue:)) and a void-returning ref function
(gst_atomic_queue_ref, unlike GstBuffer/GObject's T*-returning
convention) via new RecordPlan.copyReturnsVoid.

Adds tier-6 smoke tests (Gst/Soup/Adw version calls against the real
linked libraries) and refreshes the tier-4/5 skip baselines for the
duplicate-detection fix's legitimate coverage growth. Zero skip-baseline
drift on tiers 1-6; 220/220 unit tests and all tier smoke suites pass.
2026-07-20 21:59:10 -04:00

29 lines
1.2 KiB
Swift

// SoupSmoke.swift
// Tier-6-only runtime smoke test for Soup (Phase E5). Proves against the
// REAL libsoup-3.0, linked at runtime that the generated bindings reach
// real Soup C symbols.
//
// `getMajorVersion()`/`getMinorVersion()` reach `soup_get_major_version`/
// `soup_get_minor_version`, plain free functions that need no session,
// message, or network connection display/network-free by construction.
// Uses only plain-public API no `@_spi` import.
//
// Not generated. `scripts/smoke-test.sh <tier>` copies every `smoke/*.swift`
// plus `smoke/tier<N>/*.swift` into the generated SmokeTests target before
// running `swift test`. Only installed for tier >= 6 (Soup's module).
import Testing
import GLib
import Soup
@Suite("Tier 6 Soup smoke tests")
struct SoupSmokeTests {
@Test("getMajorVersion()/getMinorVersion() reach the real soup_get_major_version/soup_get_minor_version and report libsoup 3")
func versionFunctionsReachRealSoup() throws {
#expect(getMajorVersion() == 3)
// libsoup 3's minor version is a real, non-placeholder value
// reported by the linked library, not a stubbed default.
#expect(getMinorVersion() >= 0)
}
}