foreseen

A text-based gemini browser with prefetching
git clone git://git.laack.co/foreseen.git
Log | Files | Refs | README | LICENSE

commit fb4f0394209f42fa8931ca02bb68c0a2557817c8
parent 4ee1b99f354e033ff929f6f7cfd001323687bcda
Author: Andrew Laack <andrew@laack.co>
Date:   Sat,  3 Oct 2026 15:41:55 -0500

Added redirect test

Diffstat:
Atests/cgi-bin/redirect-to-broken.py | 4++++
Mtests/puppet-test.cpp | 22++++++++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/tests/cgi-bin/redirect-to-broken.py b/tests/cgi-bin/redirect-to-broken.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python3 +import random + +print(f"31 gemini://this-site-doesnt-exist.oarisenoaristn", end="\r\n") diff --git a/tests/puppet-test.cpp b/tests/puppet-test.cpp @@ -62,6 +62,28 @@ TEST_CASE("RESIZE falls through and returns") { delete bPtr; } +TEST_CASE("Redirect to broken doesn't deadlock") { + Browser* bPtr = new Browser {}; + Browser& b = *bPtr; + DrawState ds {}; + ds.bPtr = bPtr; + std::string dest = "ogemini://localhost/cgi-bin/redirect-to-broken.py"; + for(auto& ch : dest) { + REQUIRE(mainLoop(ds, b, ch,100,100)); + } + + for(int i = 0; i < 100; ++i) { + REQUIRE(mainLoop(ds, b, 'y',100,100)); + } + + REQUIRE(mainLoop(ds, b, 'n',100,100)); + REQUIRE(b.getCurrentLink()->getLinkDestination().to_string() == "about://newtab"); + delete bPtr; +} + + + + TEST_CASE("Open page handler returns") { Browser* bPtr = new Browser {}; Browser& b = *bPtr;