fto 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Changelog.txt +20 -0
- data/NOTICE.txt +5 -0
- data/doc/classes/FormatText/Context.html +17 -8
- data/doc/classes/FormatText/Context.src/M000008.html +1 -1
- data/doc/classes/FormatText/Context.src/M000009.html +2 -2
- data/doc/classes/FormatText/Effector.html +73 -32
- data/doc/classes/FormatText/Effector.src/M000009.html +1 -1
- data/doc/classes/FormatText/Effector.src/M000010.html +29 -5
- data/doc/classes/FormatText/Effector.src/M000011.html +5 -4
- data/doc/classes/FormatText/Effector.src/M000012.html +4 -5
- data/doc/classes/FormatText/Effector.src/M000013.html +5 -4
- data/doc/classes/FormatText/Effector.src/M000014.html +1 -1
- data/doc/classes/FormatText/FTO.html +75 -38
- data/doc/classes/FormatText/FTO.src/M000001.html +2 -1
- data/doc/classes/FormatText/FTO.src/M000002.html +4 -18
- data/doc/classes/FormatText/FTO.src/M000003.html +18 -6
- data/doc/classes/FormatText/FTO.src/M000004.html +7 -4
- data/doc/classes/FormatText/FTO.src/M000005.html +5 -8
- data/doc/classes/FormatText/FTO.src/M000006.html +8 -6
- data/doc/classes/FormatText/FTO.src/M000007.html +6 -49
- data/doc/classes/FormatText/FTO.src/M000008.html +17 -9
- data/doc/created.rid +1 -1
- data/doc/files/lib/fto_rb.html +1 -1
- data/doc/fr_method_index.html +13 -12
- data/lib/fto.rb +385 -135
- data/test/test_fto_api.rb +43 -19
- data/test/test_fto_effectors.rb +25 -0
- metadata +4 -2
data/test/test_fto_api.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require 'ruby-debug'
|
2
|
+
#require 'ruby-debug'
|
3
3
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
4
4
|
|
5
5
|
class Test_FTO_API < Test::Unit::TestCase
|
@@ -17,16 +17,16 @@ class Test_FTO_API < Test::Unit::TestCase
|
|
17
17
|
|
18
18
|
public
|
19
19
|
|
20
|
-
def
|
20
|
+
def test_001_arglistOverride()
|
21
21
|
cValue = 'construction value'
|
22
22
|
oValue = 'override value'
|
23
23
|
f = FTO.new('!AS', cValue)
|
24
24
|
assert_equal(cValue, f.format)
|
25
25
|
assert_equal(oValue, f.format(oValue))
|
26
26
|
assert_equal(cValue, f.format)
|
27
|
-
end #
|
27
|
+
end # def test_arglistOverride()
|
28
28
|
|
29
|
-
def
|
29
|
+
def test_002_findEffectors()
|
30
30
|
#
|
31
31
|
# Check for not finding anything
|
32
32
|
#
|
@@ -71,7 +71,7 @@ class Test_FTO_API < Test::Unit::TestCase
|
|
71
71
|
assert(FTO::findEffectors(Regexp.new(pattern)).length == 2)
|
72
72
|
end # def test_findEffectors()
|
73
73
|
|
74
|
-
def
|
74
|
+
def test_003_EnableDisableEffector()
|
75
75
|
e = FTO.findEffectors('^String AS$').first
|
76
76
|
#
|
77
77
|
# Check the switches and sensors around enablement. (Whether they
|
@@ -82,30 +82,40 @@ class Test_FTO_API < Test::Unit::TestCase
|
|
82
82
|
# Instance methods checking an effector enabled by instance method.
|
83
83
|
# (Actually, by assumed default.)
|
84
84
|
#
|
85
|
-
assert(e.enabled
|
86
|
-
|
85
|
+
assert(e.enabled?,
|
86
|
+
'Instance check that !AS is enabled by default')
|
87
|
+
assert(! e.disabled?,
|
88
|
+
'Instance check that !AS is not disabled by default')
|
87
89
|
|
88
90
|
#
|
89
91
|
# Instance methods checking state altered by class method.
|
90
92
|
#
|
91
93
|
FTO.disableEffector(e.id)
|
92
|
-
assert(! e.enabled
|
93
|
-
|
94
|
+
assert(! e.enabled?,
|
95
|
+
'Instance check that class method disable works (! enabled?)')
|
96
|
+
assert(e.disabled?,
|
97
|
+
'Instance check that class method disable works (disabled?')
|
94
98
|
|
95
99
|
FTO.enableEffector(e.id)
|
96
|
-
assert(e.enabled
|
97
|
-
|
100
|
+
assert(e.enabled?,
|
101
|
+
'Instance check that class method enable works (enabled?)')
|
102
|
+
assert(! e.disabled?,
|
103
|
+
'Instance check that class method enable works (! disabled?)')
|
98
104
|
|
99
105
|
#
|
100
106
|
# *Now* instance methods checking on effect of other instance methods.
|
101
107
|
#
|
102
108
|
e.disable
|
103
|
-
assert(! e.enabled
|
104
|
-
|
109
|
+
assert(! e.enabled?,
|
110
|
+
'Instance check that instance method disable works (! enabled?)')
|
111
|
+
assert(e.disabled?,
|
112
|
+
'Instance check that instance method disable works (disabled?)')
|
105
113
|
|
106
114
|
e.enable
|
107
|
-
assert(e.enabled
|
108
|
-
|
115
|
+
assert(e.enabled?,
|
116
|
+
'Instance check that instance method enable works (enabled?)')
|
117
|
+
assert(! e.disabled?,
|
118
|
+
'Instance check that instance method enable works (! disabled?)')
|
109
119
|
|
110
120
|
#
|
111
121
|
# Now time to see if this enable/disable stuff is really doing what it
|
@@ -117,27 +127,41 @@ class Test_FTO_API < Test::Unit::TestCase
|
|
117
127
|
# Test reality of disablement using the Effector.disable method.
|
118
128
|
#
|
119
129
|
e.disable
|
120
|
-
assert_equal(pattern,
|
130
|
+
assert_equal(pattern,
|
131
|
+
f.format('succeeded'),
|
132
|
+
'Checking that instance-disabled !AS("succeeded") == "!AS"')
|
121
133
|
#
|
122
134
|
# Test reality of enablement using the FTO class method.
|
123
135
|
#
|
124
136
|
FTO.enableEffector(e.id)
|
125
|
-
assert_equal('succeeded',
|
137
|
+
assert_equal('succeeded',
|
138
|
+
f.format('succeeded'),
|
139
|
+
'Checking that class-enabled !AS("succeeded") == "succeeded"')
|
126
140
|
|
127
141
|
#
|
128
142
|
# And contrariwise. Class method first.
|
129
143
|
#
|
130
144
|
FTO.disableEffector(e.id)
|
131
|
-
assert_equal(pattern,
|
145
|
+
assert_equal(pattern,
|
146
|
+
f.format('succeeded'),
|
147
|
+
'Checking that class-disabled !AS("succeeded") == "!AS"')
|
132
148
|
#
|
133
149
|
# Then instance method.
|
134
150
|
#
|
135
151
|
e.enable
|
136
|
-
assert_equal('succeeded',
|
152
|
+
assert_equal('succeeded',
|
153
|
+
f.format('succeeded'),
|
154
|
+
'Checking that instance-enabled !AS("succeeded") == "succeeded"')
|
137
155
|
#
|
138
156
|
# Make sure we leave it on!
|
139
157
|
#
|
140
158
|
FTO.enableEffector(e.id)
|
141
159
|
end # def test_EnableDisableEffector()
|
142
160
|
|
161
|
+
def test_004_clearEffectorList()
|
162
|
+
assert(! FTO.findEffectors('^').empty?)
|
163
|
+
FTO.clearEffectorList()
|
164
|
+
assert(FTO.findEffectors('^').empty?)
|
165
|
+
end # def test_clearEffectorList()
|
166
|
+
|
143
167
|
end # class Test_FTO
|
data/test/test_fto_effectors.rb
CHANGED
@@ -417,6 +417,31 @@ class Test_FTO < Test::Unit::TestCase
|
|
417
417
|
"Testing :!AD:10,[0,5]")
|
418
418
|
end # def test_strings()
|
419
419
|
|
420
|
+
public
|
421
|
+
def test_datetime()
|
422
|
+
#
|
423
|
+
# @TODO: Test passing 0 for the time
|
424
|
+
#
|
425
|
+
# Our test time is 2012-02-29 14:15:16
|
426
|
+
#
|
427
|
+
t = Time.mktime(2012, 2, 29, 14, 15, 16)
|
428
|
+
assert_equal(':2012-02-29 14:15:16:',
|
429
|
+
FTO.new(':!%T(%Y-%m-%d %H:%M:%S!):', t).format,
|
430
|
+
'Testing :!%T(%Y-%m-%d %H:%M:%S!):')
|
431
|
+
|
432
|
+
assert_equal(':2012-02-29:',
|
433
|
+
FTO.new(':!%T(%Y-%m-%d!):', t).format,
|
434
|
+
'Testing :!%T(%Y-%m-%d!):')
|
435
|
+
|
436
|
+
assert_equal(':2012-02-29:',
|
437
|
+
FTO.new(':!10%T(%Y-%m-%d %H:%M:%S!):', t).format,
|
438
|
+
'Testing :!10%T(%Y-%m-%d %H:%M:%S!):')
|
439
|
+
|
440
|
+
assert_equal(':2012-02-29 :',
|
441
|
+
FTO.new(':!15%T(%Y-%m-%d!):', t).format,
|
442
|
+
'Testing :!15%T(%Y-%m-%d!):')
|
443
|
+
end # def test_datetime()
|
444
|
+
|
420
445
|
def test_plurals()
|
421
446
|
assert_equal(FTO.new('I have !SB boat!%S', -1).format, 'I have -1 boats')
|
422
447
|
assert_equal(FTO.new('I HAVE !SB BOAT!%S', -1).format, 'I HAVE -1 BOATS')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodent of Unusual Size
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-07 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -43,7 +43,9 @@ extra_rdoc_files: []
|
|
43
43
|
files:
|
44
44
|
- CONTRIBUTORS.txt
|
45
45
|
- LICENCE.txt
|
46
|
+
- NOTICE.txt
|
46
47
|
- README.txt
|
48
|
+
- Changelog.txt
|
47
49
|
- lib/fto.rb
|
48
50
|
- test/test_fto_api.rb
|
49
51
|
- test/test_helper.rb
|