1+ script "CoreChunksTrueWord"
2+ /*
3+ Copyright (C) 2015 LiveCode Ltd.
4+
5+ This file is part of LiveCode.
6+
7+ LiveCode is free software; you can redistribute it and/or modify it under
8+ the terms of the GNU General Public License v3 as published by the Free
9+ Software Foundation.
10+
11+ LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
12+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ for more details.
15+
16+ You should have received a copy of the GNU General Public License
17+ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
18+
19+ on TestTrueWordRanges
20+ TestAssert "overlong prefix" , trueWord - 4 to - 2 of "three trueWord sentence" is "three trueWord"
21+ TestAssert "overlong suffix" , trueWord 2 to 4 of "three trueWord sentence" is "trueWord sentence"
22+ end TestTrueWordRanges
23+
24+ on TestTrueWordRangesEmpty
25+ TestAssert "empty prefix" , trueWord - 5 to - 4 of "three trueWord sentence" is ""
26+ TestAssert "empty suffix" , trueWord 4 to 5 of "three trueWord sentence" is ""
27+ TestAssert "empty range" , trueWord 5 to 4 of "three trueWord sentence" is ""
28+ end TestTrueWordRangesEmpty
29+
30+ on TestTrueWordRangesSingle
31+ TestAssert "single trueWord range" , trueWord 1 to 1 of "three trueWord sentence" is "three"
32+ TestAssert "single trueWord range from back" , trueWord - 2 to - 2 of "three trueWord sentence" is "trueWord"
33+ end TestTrueWordRangesSingle
34+
35+ on TestTrueWordExpressions
36+ TestAssert "single trueWord" , trueWord 1 of "three trueWord sentence" is "three"
37+ TestAssert "single trueWord from back" , trueWord - 3 of "three trueWord sentence" is "three"
38+ end TestTrueWordExpressions
39+
40+ on TestTrueWordExpressionsEmpty
41+ TestAssert "single trueWord" , trueWord 4 of "three trueWord sentence" is ""
42+ TestAssert "single trueWord" , trueWord - 4 of "three trueWord sentence" is ""
43+ end TestTrueWordExpressionsEmpty
44+
45+ on TestTrueWordLineBreakCount
46+ TestAssert "count with line break" , the number of trueWords in ("one" & return & "two" ) is 2
47+ end TestTrueWordLineBreakCount
48+
49+ on TestTrueWordLineBreakExpression
50+ TestAssert "single trueWord" , trueWord 2 of ("one" & return & "two" ) is "two"
51+ end TestTrueWordLineBreakExpression
52+
53+ on TestTrueWordCount
54+ TestAssert "count" , the number of trueWords in "three trueWord sentence" is 3
55+ end TestTrueWordCount
56+
57+ on TestLastTrueWord
58+ TestAssert "last trueWord" , the last trueWord of "three trueWord sentence" is "sentence"
59+ end TestLastTrueWord
0 commit comments