123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- local p = premake
- local suite = test.declare("context")
- local context = p.context
- local configset = p.configset
- local field = p.field
- local ctx, cset
- function suite.setup()
- cset = configset.new()
- ctx = context.new(cset)
- end
- function suite.new_returnsValidObject()
- test.isequal("table", type(ctx))
- end
- function suite.returnsConfigValue_onExistingValue()
- configset.store(cset, field.get("targetextension"), ".so")
- test.isequal(".so", ctx.targetextension)
- end
- function suite.doesExpandTokens()
- configset.store(cset, field.get("targetname"), "MyProject%{1 + 1}")
- test.isequal("MyProject2", ctx.targetname)
- end
- function suite.extent()
-
- configset.store(cset, field.get("targetname"), "%{value}")
-
- test.isequal("", ctx.targetname)
-
- local environ = {
- value = "text"
- }
- local ext = context.extent(ctx, environ)
-
- test.isequal("text", ext.targetname)
- end
- 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
|