-
Notifications
You must be signed in to change notification settings - Fork 9
/
deepl.bats
86 lines (71 loc) · 2.07 KB
/
deepl.bats
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env bats
teardown() {
sleep 1
}
@test "No parameters" {
run ./deepl.sh
[[ "$status" -eq 1 ]]
}
@test "Missing dot" {
run ./deepl.sh "Vogel"
[[ "$status" -eq 0 ]]
[[ "$output" == *"End query with a dot"* ]]
}
@test "Single Word" {
run ./deepl.sh -l EN "Vogel."
[[ "$status" -eq 0 ]]
[[ "$output" == *"bird"* ]]
}
@test "Trailing spaces" {
run ./deepl.sh " Vogel. "
[[ "$status" -eq 0 ]]
[[ "$output" == *"bird"* ]]
}
@test "Sentence" {
run ./deepl.sh -l DE "Translate from any language."
[[ "$status" -eq 0 ]]
[[ "$output" == *"aus jeder Sprache"* ]]
}
@test "Umlaut source" {
run ./deepl.sh -l EN "Erdöl."
[[ "$status" -eq 0 ]]
[[ "$output" == *"oil"* ]]
}
@test "Umlaut destination" {
run ./deepl.sh -l DE "Oil."
[[ "$status" -eq 0 ]]
[[ "$output" == *"öl"* ]]
}
@test "Quote source" {
run ./deepl.sh -l DE "I'll."
[[ "$status" -eq 0 ]]
[[ "$output" == *"Ich werde"* ]]
}
@test "Quote destination" {
run ./deepl.sh -l EN "Ich werde."
[[ "$status" -eq 0 ]]
[[ "$output" == *"I'll be"* ]]
}
@test "Double quote source" {
run ./deepl.sh -l EN '"Apfel".'
[[ "$status" -eq 0 ]]
[[ "$output" == *'\"Apple\"'* ]]
}
#todo: fixme #6
#@test "Spanisch" {
# run ./deepl.sh -l EN "El tiempo es una ilusión."
# [[ "$status" -eq 0 ]]
# [[ "$output" == *'\"time\"'* ]]
#}
#todo: fixme #1
#@test "Long sentences" {
# run ./deepl.sh -l DE "He felt that his whole life was some kind of dream and he sometimes wondered whose it was and whether they were enjoying it."
# [[ "$status" -eq 0 ]]
# [[ "$output" == *'\"Leben\"'* ]]
#}
#todo: fixme #1
#@test "Multi sentences" {
# run ./deepl.sh -l DE "This planet has - or rather had - a problem, which was this: most of the people living on it were unhappy for pretty much of the time. Many solutions were suggested for this problem, but most of these were largely concerned with the movement of small green pieces of paper, which was odd because on the whole it wasn't the small green pieces of paper that were unhappy."
# [[ "$status" -eq 0 ]]
# [[ "$output" == *'\"unglücklich\"'* ]]
#}