Merge branch 'master' into systemversion
This commit is contained in:
commit
9f1b32fa23
@ -137,8 +137,12 @@
|
||||
--
|
||||
|
||||
function context.mergeFilters(ctx, src)
|
||||
for k,v in pairs(src.terms) do
|
||||
ctx.terms[k] = v
|
||||
for k, v in pairs(src.terms) do
|
||||
if k == "tags" then
|
||||
ctx.terms[k] = table.join(ctx.terms[k], v)
|
||||
else
|
||||
ctx.terms[k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -73,3 +73,41 @@
|
||||
-- detoken in extended context should result in value set in that environ.
|
||||
test.isequal("text", ext.targetname)
|
||||
end
|
||||
|
||||
--
|
||||
-- mergeFilters should behave as expected for tags
|
||||
--
|
||||
|
||||
function suite.mergeFilters()
|
||||
|
||||
ctx = { terms = { tags = { "ctxtags" } } }
|
||||
src = { terms = { tags = { "srctags" } } }
|
||||
|
||||
context.mergeFilters(ctx, src)
|
||||
|
||||
result = { terms = { tags = { "ctxtags", "srctags" } } }
|
||||
|
||||
test.isequal(result, ctx)
|
||||
end
|
||||
|
||||
function suite.mergeFilters_keeptype()
|
||||
|
||||
ctx = { terms = { kind = "ConsoleApp" } }
|
||||
src = { terms = { kind = "ConsoleApp" } }
|
||||
|
||||
context.mergeFilters(ctx, src)
|
||||
|
||||
test.isequal("string", type(ctx.terms.kind))
|
||||
end
|
||||
|
||||
function suite.mergeFilters_createtable()
|
||||
|
||||
ctx = { terms = { tags = "ctxtags" } }
|
||||
src = { terms = { tags = "srctags" } }
|
||||
|
||||
context.mergeFilters(ctx, src)
|
||||
|
||||
result = { terms = { tags = { "ctxtags", "srctags" } } }
|
||||
|
||||
test.isequal(result, ctx)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user