Skip to content

Instantly share code, notes, and snippets.

@Strykar
Created April 12, 2026 19:54
Show Gist options
  • Select an option

  • Save Strykar/3432443cd04d1f8b49661c0b50a1f2e3 to your computer and use it in GitHub Desktop.

Select an option

Save Strykar/3432443cd04d1f8b49661c0b50a1f2e3 to your computer and use it in GitHub Desktop.
t/depends.t ..
ok 1 - require AUR::Depends;
# Subtest: graph: single target, no deps
ok 1 - self edge for target foo
ok 2 - no foreign deps
1..2
ok 2 - graph: single target, no deps
# Subtest: graph: linear chain A -> B -> C
ok 1 - A self edge
ok 2 - B required by A
ok 3 - C required by B
1..3
ok 3 - graph: linear chain A -> B -> C
# Subtest: graph: target with empty depends
ok 1 - self edge exists
ok 2 - only one node in DAG
1..2
ok 4 - graph: target with empty depends
# Subtest: graph: foreign dependency
ok 1 - self edge
ok 2 - glibc in foreign DAG
ok 3 - glibc not in main DAG
1..3
ok 5 - graph: foreign dependency
# Subtest: graph: provider ($provides=1)
ok 1 - edge goes through provider-pkg when $provides=1
1..1
ok 6 - graph: provider ($provides=1)
# Subtest: graph: provider disabled ($provides=0)
ok 1 - edge goes to libfoo directly when $provides=0
ok 2 - provider-pkg not in DAG when $provides=0
1..2
ok 7 - graph: provider disabled ($provides=0)
# Subtest: graph: self edge with provider redirection
ok 1 - self edge redirected through provider (current behavior)
1..1
ok 8 - graph: self edge with provider redirection
# Subtest: graph: versioned dependency passes vercmp
ok 1 - versioned dep libbar>=3.0 satisfied by 3.5
1..1
ok 9 - graph: versioned dependency passes vercmp
# Subtest: graph: multiple dep types
ok 1 - Depends edge
ok 2 - MakeDepends edge
ok 3 - CheckDepends edge
1..3
ok 10 - graph: multiple dep types
# Subtest: graph: multiple targets each get self edges
ok 1 - X self edge
ok 2 - Y self edge
1..2
ok 11 - graph: multiple targets each get self edges
# Subtest: graph: pkgdeps values are always arrayrefs (dead code proof)
ok 1 - pkgdeps entry is ARRAY ref, not a scalar (confirms \#1252)
ok 2 - arrayref ne string is always true
1..2
ok 12 - graph: pkgdeps values are always arrayrefs (dead code proof)
# Subtest: prune: removes installed packages
ok 1 - C was pruned
ok 2 - C removed from DAG
ok 3 - A remains in DAG
ok 4 - B remains in DAG
1..4
ok 13 - prune: removes installed packages
# Subtest: prune: cascading removal of orphaned deps
ok 1 - A was pruned
ok 2 - B was pruned (cascading)
ok 3 - DAG is empty after cascading prune
1..3
ok 14 - prune: cascading removal of orphaned deps
# Subtest: prune: empty installed list
ok 1 - nothing pruned
ok 2 - DAG unchanged
1..2
ok 15 - prune: empty installed list
# Subtest: tsort: linear chain
ok 1 - C first (deepest)
ok 2 - A last (root)
1..2
ok 16 - tsort: linear chain
# Subtest: tsort: self loop only
ok 1 - one element
ok 2 - element is X
1..2
ok 17 - tsort: self loop only
# Subtest: tsort: BFS mode
ok 1 - D first in BFS (only node with no predecessors)
ok 2 - A last in BFS (leaf)
1..2
ok 18 - tsort: BFS mode
# Subtest: recurse: single target, no deps
ok 1 - pkg-a in results
ok 2 - correct version
ok 3 - self dep spec
ok 4 - self dep type
ok 5 - no providers
1..5
ok 19 - recurse: single target, no deps
# Subtest: recurse: multi-level A -> B -> C
ok 1 - A in results
ok 2 - B in results
ok 3 - C in results
ok 4 - A has 2 pkgdeps entries
ok 5 - A depends on B
ok 6 - dep type is Depends
ok 7 - B depends on C
ok 8 - dep type is Depends
1..8
ok 20 - recurse: multi-level A -> B -> C
# Subtest: recurse: dedup - shared dep queried once
ok 1 - shared in results
ok 2 - callback called exactly twice (no dup queries)
1..2
ok 21 - recurse: dedup - shared dep queried once
# Subtest: recurse: provides populate pkgmap
ok 1 - virtual-pkg in pkgmap
ok 2 - provider is real-pkg
ok 3 - provider version is 2.0
1..3
ok 22 - recurse: provides populate pkgmap
# Subtest: recurse: self-provide excluded from pkgmap
ok 1 - self-provide not added to pkgmap (line 102: $prov ne $name)
1..1
ok 23 - recurse: self-provide excluded from pkgmap
# Subtest: recurse: first provider takes precedence
ok 1 - first provider wins
1..1
ok 24 - recurse: first provider takes precedence
# Subtest: recurse: dep type filtering
ok 1 - libx resolved (Depends)
ok 2 - build-tool not resolved (MakeDepends filtered out)
ok 3 - test-fw not resolved (CheckDepends filtered out)
1..3
ok 25 - recurse: dep type filtering
# Subtest: recurse: OptDepends resolves when requested
ok 1 - plugin not resolved under default dep_types
ok 2 - plugin resolved when OptDepends requested
ok 3 - libx still resolved alongside OptDepends
1..3
ok 26 - recurse: OptDepends resolves when requested
# Subtest: recurse: Conflicts and Replaces pass through to results
ok 1 - Conflicts preserved verbatim in results
ok 2 - Replaces preserved verbatim in results
1..2
ok 27 - recurse: Conflicts and Replaces pass through to results
# Subtest: graph: versioned dep fails vercmp
ok 1 - graph exits with EX_FAILURE on version mismatch
1..1
ok 28 - graph: versioned dep fails vercmp
# Subtest: tsort: cycle detection
ok 1 - cycle warning emitted
ok 2 - no nodes output for pure cycle
1..2
ok 29 - tsort: cycle detection
# Subtest: tsort: partial cycle with sortable nodes
ok 1 - cycle warning for A-B cycle
ok 2 - only C is sortable
ok 3 - C output before cycle
1..3
ok 30 - tsort: partial cycle with sortable nodes
# Subtest: graph: empty pkgdeps
ok 1 - empty DAG
ok 2 - empty foreign DAG
1..2
ok 31 - graph: empty pkgdeps
# Subtest: recurse: no results exits with EX_FAILURE
ok 1 - recurse exits EX_FAILURE when no packages found
1..1
ok 32 - recurse: no results exits with EX_FAILURE
# Subtest: graph: versioned dep operators
ok 1 - lib=2.0 satisfied by 2.0
ok 2 - lib<2.0 satisfied by 1.5
ok 3 - lib<=2.0 satisfied by 2.0 (boundary)
ok 4 - lib>2.0 satisfied by 3.0
ok 5 - lib>=2.0 satisfied by 2.0 (boundary)
1..5
ok 33 - graph: versioned dep operators
# Subtest: tsort: single non-self pair
ok 1 - two elements
ok 2 - A first (no predecessors)
ok 3 - B second (successor of A)
1..3
ok 34 - tsort: single non-self pair
# Subtest: prune: max fan-in removal
ok 1 - base was pruned
ok 2 - dep-a cascaded
ok 3 - dep-b cascaded
ok 4 - dep-c cascaded
ok 5 - DAG fully emptied
1..5
ok 35 - prune: max fan-in removal
# Subtest: prune: leaf removal does not cascade upward
ok 1 - B was pruned
ok 2 - A remains
ok 3 - C remains
1..3
ok 36 - prune: leaf removal does not cascade upward
# Subtest: pipeline: target lost when provider exists
ok 1 - pkgmap: bar provides foo
ok 2 - foo stays in results (not in @removed)
ok 3 - BUG: foo has no node in the DAG
ok 4 - BUG: libx orphaned and pruned (foo dependency lost)
ok 5 - bar survives in results
1..5
ok 37 - pipeline: target lost when provider exists
# Subtest: pipeline: target preserved when provides=0
ok 1 - foo preserved when provides=0
ok 2 - foo self-edge intact
ok 3 - bar also preserved
1..3
ok 38 - pipeline: target preserved when provides=0
# Subtest: pipeline: single target vanishes via transitive provider
ok 1 - foo stays in results
ok 2 - BUG: bar removed from results (cascading prune)
ok 3 - BUG: DAG completely empty - no build order possible
1..3
ok 39 - pipeline: single target vanishes via transitive provider
# Subtest: fixture: liri-git-meta
ok 1 - target liri-git-meta has self-edge
ok 2 - target liri-git-meta in results after pipeline
ok 3 - target liri-git-meta in DAG after prune
ok 4 - no dangling DAG nodes (all in results)
ok 5 - no foreign deps in main DAG
ok 6 - tsort output has no duplicates
ok 7 - target liri-git-meta in tsort output
1..7
ok 40 - fixture: liri-git-meta
# Subtest: fixture: python2-cryptography
ok 1 - target python2-cryptography has self-edge
ok 2 - target python2-cryptography in results after pipeline
ok 3 - target python2-cryptography in DAG after prune
ok 4 - no dangling DAG nodes (all in results)
ok 5 - no foreign deps in main DAG
ok 6 - tsort output has no duplicates
ok 7 - tsort output (39) <= DAG nodes (76)
1..7
ok 41 - fixture: python2-cryptography
# Subtest: fixture: ruby-activemodel
ok 1 - target ruby-activemodel has self-edge
ok 2 - target ruby-activemodel in results after pipeline
ok 3 - target ruby-activemodel in DAG after prune
ok 4 - no dangling DAG nodes (all in results)
ok 5 - no foreign deps in main DAG
ok 6 - tsort output has no duplicates
ok 7 - tsort output (7) <= DAG nodes (16)
1..7
ok 42 - fixture: ruby-activemodel
1..42
ok
All tests successful.
Files=1, Tests=42, 0 wallclock secs ( 0.01 usr 0.00 sys + 0.03 cusr 0.02 csys = 0.06 CPU)
Result: PASS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment