diff --git a/src/archive.c.v b/src/package/archive.c.v similarity index 99% rename from src/archive.c.v rename to src/package/archive.c.v index 1f0d1dd..d8fccd2 100644 --- a/src/archive.c.v +++ b/src/package/archive.c.v @@ -1,4 +1,5 @@ // Bindings for the libarchive library +module package #flag -larchive diff --git a/src/server/git_test.v b/src/server/git_test.v new file mode 100644 index 0000000..05ac6fc --- /dev/null +++ b/src/server/git_test.v @@ -0,0 +1,36 @@ +module server + +import os +import net.http +import io.util as io_util +import time + +fn launch_server() ? { + tmp_dir := io_util.temp_dir() ? + conf := Config{ + pkg_dir: os.join_path_single(tmp_dir, 'pkgs') + data_dir: tmp_dir + api_key: 'testing' + default_arch: 'x86_64' + } + + go server(conf) + + for waiting_cycles := 0; waiting_cycles < 50; waiting_cycles++ { + time.sleep(100 * time.millisecond) + http.get('http://127.0.0.1:$port') or { continue } + break + } +} + +fn test_git_api() ? { + launch_server() ? + + assert http.get('http://localhost:$port') ?.status_code == 404 +} + +fn test_something_api() ? { + launch_server() ? + + assert http.get('http://localhost:$port') ?.status_code == 404 +}