aboutsummaryrefslogtreecommitdiff
path: root/jarink_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-06-12 21:13:58 +0700
committerShulhan <ms@kilabit.info>2025-06-12 21:13:58 +0700
commita02e915388723a5d8cc3b555fb3dfec477fc2a55 (patch)
treeaa35678b263646e1edd730a16cb35a66e7b933d8 /jarink_test.go
parentf408c77795a9dd6d4551fadd2e8352ba08915feb (diff)
downloadjarink-a02e915388723a5d8cc3b555fb3dfec477fc2a55.tar.xz
all: refactoring, move brokenlinks code to its own package
When two or more struct has the same prefix that means it is time to move it to group it. Also, we will group one command to one package in the future.
Diffstat (limited to 'jarink_test.go')
-rw-r--r--jarink_test.go70
1 files changed, 0 insertions, 70 deletions
diff --git a/jarink_test.go b/jarink_test.go
deleted file mode 100644
index 91d38a0..0000000
--- a/jarink_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-// SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info>
-// SPDX-License-Identifier: GPL-3.0-only
-
-package jarink_test
-
-import (
- "log"
- "net/http"
- "os"
- "testing"
- "time"
-
- libnet "git.sr.ht/~shulhan/pakakeh.go/lib/net"
-)
-
-// The test run two web servers that serve content on "testdata/web/".
-// The first web server is the one that we want to scan.
-// The second web server is external web server, where HTML pages should not
-// be parsed.
-
-const testAddress = `127.0.0.1:11836`
-const testExternalAddress = `127.0.0.1:11900`
-
-func TestMain(m *testing.M) {
- log.SetFlags(0)
- var httpDirWeb = http.Dir(`testdata/web`)
- var fshandle = http.FileServer(httpDirWeb)
-
- go func() {
- var mux = http.NewServeMux()
- mux.Handle(`/`, fshandle)
- var testServer = &http.Server{
- Addr: testAddress,
- Handler: mux,
- ReadTimeout: 10 * time.Second,
- WriteTimeout: 10 * time.Second,
- MaxHeaderBytes: 1 << 20,
- }
- var err = testServer.ListenAndServe()
- if err != nil {
- log.Fatal(err)
- }
- }()
- go func() {
- var mux = http.NewServeMux()
- mux.Handle(`/`, fshandle)
- var testServer = &http.Server{
- Addr: testExternalAddress,
- Handler: mux,
- ReadTimeout: 10 * time.Second,
- WriteTimeout: 10 * time.Second,
- MaxHeaderBytes: 1 << 20,
- }
- var err = testServer.ListenAndServe()
- if err != nil {
- log.Fatal(err)
- }
- }()
-
- var err = libnet.WaitAlive(`tcp`, testAddress, 5*time.Second)
- if err != nil {
- log.Fatal(err)
- }
- err = libnet.WaitAlive(`tcp`, testExternalAddress, 5*time.Second)
- if err != nil {
- log.Fatal(err)
- }
-
- os.Exit(m.Run())
-}