# Path: pre_commit/prefix.py
# class Prefix(NamedTuple):
#     prefix_dir: str
# 
#     def path(self, *parts: str) -> str:
#         return os.path.normpath(os.path.join(self.prefix_dir, *parts))
# 
#     def exists(self, *parts: str) -> bool:
#         return os.path.exists(self.path(*parts))
# 
#     def star(self, end: str) -> tuple[str, ...]:
#         paths = os.listdir(self.prefix_dir)
#         return tuple(path for path in paths if path.endswith(end))


import os.path
import pytest
from pre_commit.prefix import Prefix
from __future__ import annotations





def norm_slash(*args):
    return tuple(x.replace('/', os.sep) for x in args)


@pytest.mark.parametrize(
    ('prefix', 'path_end', 'expected_output'),
    (
        norm_slash('foo', '', 'foo'),
        norm_slash('foo', 'bar', 'foo/bar'),
        norm_slash('foo/bar', '../baz', 'foo/baz'),
        norm_slash('./', 'bar', 'bar'),
        norm_slash('./', '', '.'),
        norm_slash('/tmp/foo', '/tmp/bar', '/tmp/bar'),
    ),
)
def test_path(prefix, path_end, expected_output):

# Path: pre_commit/prefix.py
# class Prefix(NamedTuple):
#     prefix_dir: str
# 
#     def path(self, *parts: str) -> str:
#         return os.path.normpath(os.path.join(self.prefix_dir, *parts))
# 
#     def exists(self, *parts: str) -> bool:
#         return os.path.exists(self.path(*parts))
# 
#     def star(self, end: str) -> tuple[str, ...]:
#         paths = os.listdir(self.prefix_dir)
#         return tuple(path for path in paths if path.endswith(end))


# Path: tests/prefix_test.py
import os.path
import pytest
from pre_commit.prefix import Prefix

from __future__ import annotations





def norm_slash(*args):
    return tuple(x.replace('/', os.sep) for x in args)


@pytest.mark.parametrize(
    ('prefix', 'path_end', 'expected_output'),
    (
        norm_slash('foo', '', 'foo'),
        norm_slash('foo', 'bar', 'foo/bar'),
        norm_slash('foo/bar', '../baz', 'foo/baz'),
        norm_slash('./', 'bar', 'bar'),
        norm_slash('./', '', '.'),
        norm_slash('/tmp/foo', '/tmp/bar', '/tmp/bar'),
    ),
)
def test_path(prefix, path_end, expected_output):

    instance = Prefix(prefix)