diff --git a/.reuse/dep5 b/.reuse/dep5 index c50a9dde..f8ab3117 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -120,4 +120,8 @@ License: Apache-2.0 Files: tests/test_cargo/* Copyright: 2024 LG Electronics -License: Apache-2.0 \ No newline at end of file +License: Apache-2.0 + +Files: tests/test_mod/* +Copyright: 2024 junegunn(Junegunn Choi) +License: MIT \ No newline at end of file diff --git a/tests/pytest/conftest.py b/tests/pytest/conftest.py index ad144113..7c60343c 100644 --- a/tests/pytest/conftest.py +++ b/tests/pytest/conftest.py @@ -22,7 +22,8 @@ "tests/result/nuget2", "tests/result/pub", "tests/result/pypi", - "tests/result/cargo" + "tests/result/cargo", + "tests/result/mod" ] remove_directories = set_up_directories diff --git a/tests/pytest/package_manager/test_mod.py b/tests/pytest/package_manager/test_mod.py new file mode 100644 index 00000000..e7c51c37 --- /dev/null +++ b/tests/pytest/package_manager/test_mod.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2024 LG Electronics Inc. +# SPDX-License-Identifier: Apache-2.0 +import os +import pytest +import subprocess + + +DIST_PATH = os.path.join(os.environ.get("TOX_PATH"), "dist", "cli.exe") + + +@pytest.mark.parametrize("input_path, output_path, extra_args", [ + ("tests/test_mod", "tests/result/mod", "-m mod") +]) +@pytest.mark.ubuntu +def test_ubuntu(input_path, output_path, extra_args): + command = f"fosslight_dependency -p {input_path} -o {output_path} {extra_args}" + result = subprocess.run(command, shell=True, capture_output=True, text=True) + assert result.returncode == 0, f"Command failed: {command}\nstdout: {result.stdout}\nstderr: {result.stderr}" + assert any(os.scandir(output_path)), f"Output file does not exist: {output_path}" + + +@pytest.mark.parametrize("input_path, output_path", [ + (os.path.join("tests", "test_mod"), os.path.join("tests", "result", "mod")), +]) +@pytest.mark.windows +def test_windows(input_path, output_path): + command = f"{DIST_PATH} -p {input_path} -o {output_path}" + result = subprocess.run(command, capture_output=True, text=True) + assert result.returncode == 0, f"Command failed: {command}\nstdout: {result.stdout}\nstderr: {result.stderr}" + assert any(os.scandir(output_path)), f"Output file does not exist: {output_path}" diff --git a/tests/test_mod/go.mod b/tests/test_mod/go.mod new file mode 100644 index 00000000..7fe2eab2 --- /dev/null +++ b/tests/test_mod/go.mod @@ -0,0 +1,20 @@ +module github.com/junegunn/fzf + +require ( + github.com/charlievieth/fastwalk v1.0.8 + github.com/gdamore/tcell/v2 v2.7.4 + github.com/junegunn/go-shellwords v0.0.0-20240813092932-a62c48c52e97 + github.com/mattn/go-isatty v0.0.20 + github.com/rivo/uniseg v0.4.7 + golang.org/x/sys v0.26.0 + golang.org/x/term v0.25.0 +) + +require ( + github.com/gdamore/encoding v1.0.0 // indirect + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect + golang.org/x/text v0.14.0 // indirect +) + +go 1.20 \ No newline at end of file