Skip to content

Commit 03fa2eb

Browse files
committed
Expand test coverage for property accessors
1 parent c49e1cc commit 03fa2eb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

spec/fluent_spec.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ foo =
119119
assert.same("bar", bundle["foo"]:format())
120120
assert.same("baz", bundle.bar:format())
121121
assert.same("baz", bundle["bar"]:format())
122+
assert.error(function () return bundle.apple:format() end)
123+
assert.error(function () return bundle["apple"]:format() end)
122124
end)
123125

124126
pending('attributes can be accessed as properties', function ()
@@ -136,24 +138,31 @@ foo =
136138
end)
137139

138140
it('updates messages when messages are readded', function ()
141+
assert.same("bar", bundle.foo())
139142
assert.same("bar", bundle:format("foo"))
143+
assert.same("baz", bundle.bar())
140144
assert.same("baz", bundle:format("bar"))
141145
bundle:add_messages("bar = rebar")
146+
assert.same("bar", bundle.foo())
142147
assert.same("bar", bundle:format("foo"))
148+
assert.same("rebar", bundle.bar())
143149
assert.same("rebar", bundle:format("bar"))
144150
end)
145151

146152
it('preserves attributes when messages are added', function ()
153+
assert.same("baz", bundle.bar())
147154
assert.same("baz", bundle:format("bar"))
148155
assert.same("qux", bundle:get_message("bar"):get_attribute("bax")())
149156
-- assert.same("qux", bundle["bar.bax"]())
150157
-- assert.same("qux", bundle.bar.bax())
151158
bundle:add_messages("aa = bb")
152159
-- assert.same("qux", bundle["bar.bax"]())
153160
-- assert.same("qux", bundle.bar:get_attribute("bax")())
161+
assert.same("baz", bundle.bar())
154162
assert.same("baz", bundle:format("bar"))
155163
assert.same("qux", bundle:get_message("bar"):get_attribute("bax")())
156164
bundle:add_messages("bar = rebar")
165+
assert.same("rebar", bundle.bar())
157166
assert.same("rebar", bundle:format("bar"))
158167
assert.error(function() return bundle:get_message("bar"):get_attribute("bax")() end)
159168
-- assert.same("qux", bundle.bar.bax())

0 commit comments

Comments
 (0)