summaryrefslogtreecommitdiffstats
path: root/lang/python/python-slugify/test.sh
blob: e1ca5833082f4a7be859efd3844a5a1396a8b638 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh

[ "$1" = python3-slugify ] || exit 0

python3 - << 'EOF'
from slugify import slugify

# Basic ASCII
assert slugify('Hello World') == 'hello-world', f"got: {slugify('Hello World')}"

# Unicode transliteration
assert slugify('Héllo Wörld') == 'hello-world', f"got: {slugify('Héllo Wörld')}"

# Special characters stripped
assert slugify('Hello, World!') == 'hello-world', f"got: {slugify('Hello, World!')}"

# Numbers preserved
assert slugify('test 123') == 'test-123', f"got: {slugify('test 123')}"

# Custom separator
assert slugify('Hello World', separator='_') == 'hello_world'

# Max length
result = slugify('a very long title that should be truncated', max_length=10)
assert len(result) <= 10, f"length {len(result)} > 10"

print("python-slugify OK")
EOF