|
| 1 | +# SPDX-License-Identifier: MPL-2.0 |
| 2 | +# (PMPL-1.0-or-later preferred; MPL-2.0 required for Julia ecosystem) |
| 3 | +# E2E pipeline tests for Hyperpolymath.jl. |
| 4 | +# Hyperpolymath is an umbrella package; E2E tests validate the source file |
| 5 | +# structure and dependency declarations without requiring all sub-packages |
| 6 | +# to be installed in the CI environment. |
| 7 | + |
| 8 | +using Test |
| 9 | + |
| 10 | +@testset "E2E Pipeline Tests" begin |
| 11 | + |
| 12 | + @testset "Full pipeline: source file is loadable as text" begin |
| 13 | + src_path = joinpath(@__DIR__, "..", "src", "Hyperpolymath.jl") |
| 14 | + @test isfile(src_path) |
| 15 | + content = read(src_path, String) |
| 16 | + @test !isempty(content) |
| 17 | + end |
| 18 | + |
| 19 | + @testset "Full pipeline: module declaration is well-formed" begin |
| 20 | + src_path = joinpath(@__DIR__, "..", "src", "Hyperpolymath.jl") |
| 21 | + content = read(src_path, String) |
| 22 | + # Must open and close module correctly. |
| 23 | + @test contains(content, "module Hyperpolymath") |
| 24 | + @test contains(content, "end # module") |
| 25 | + # Module name must match file name (Julia convention). |
| 26 | + @test count("module Hyperpolymath", content) == 1 |
| 27 | + end |
| 28 | + |
| 29 | + @testset "Full pipeline: all required sub-package groups declared" begin |
| 30 | + src_path = joinpath(@__DIR__, "..", "src", "Hyperpolymath.jl") |
| 31 | + content = read(src_path, String) |
| 32 | + required_deps = [ |
| 33 | + "Axiom", "MacroPower", "SiliconCore", |
| 34 | + "LowLevel", "HardwareResilience", "ShellIntegration", "MinixSDK", |
| 35 | + ] |
| 36 | + for dep in required_deps |
| 37 | + @test contains(content, "using $(dep)") |
| 38 | + end |
| 39 | + end |
| 40 | + |
| 41 | + @testset "Error handling: graceful degradation when deps absent" begin |
| 42 | + # Loading may fail without all sub-packages; verify the try/catch path. |
| 43 | + attempted = false |
| 44 | + succeeded = false |
| 45 | + try |
| 46 | + attempted = true |
| 47 | + # Attempt (may fail due to missing deps in test env). |
| 48 | + include(joinpath(@__DIR__, "..", "src", "Hyperpolymath.jl")) |
| 49 | + succeeded = true |
| 50 | + catch e |
| 51 | + # Expected when dependencies are not registered. |
| 52 | + @info "Hyperpolymath.jl load failed (expected in isolated env)" exception=e |
| 53 | + end |
| 54 | + @test attempted |
| 55 | + # Either it loaded or it failed gracefully — no crash without try/catch. |
| 56 | + end |
| 57 | + |
| 58 | + @testset "Round-trip consistency: SPDX header survives file read" begin |
| 59 | + src_path = joinpath(@__DIR__, "..", "src", "Hyperpolymath.jl") |
| 60 | + lines = readlines(src_path) |
| 61 | + @test length(lines) >= 1 |
| 62 | + first_line = lines[1] |
| 63 | + @test contains(first_line, "SPDX-License-Identifier") |
| 64 | + @test contains(first_line, "PMPL-1.0-or-later") |
| 65 | + end |
| 66 | + |
| 67 | + @testset "Round-trip consistency: file encoding is valid UTF-8" begin |
| 68 | + src_path = joinpath(@__DIR__, "..", "src", "Hyperpolymath.jl") |
| 69 | + # read as String validates UTF-8 automatically in Julia. |
| 70 | + content = read(src_path, String) |
| 71 | + @test content isa String |
| 72 | + @test ncodeunits(content) >= 1 |
| 73 | + end |
| 74 | + |
| 75 | +end |
0 commit comments