annotate Libs/LibStub/tests/test4.lua @ 22:3596dadf9a90 v8.1.0.022

- ToC and Libraries update.
author Tercioo
date Mon, 31 Dec 2018 11:30:31 -0200
parents fc346da3afd9
children
rev   line source
tercio@0 1 debugstack = debug.traceback
tercio@0 2 strmatch = string.match
tercio@0 3
tercio@0 4 loadfile("../LibStub.lua")()
tercio@0 5
tercio@0 6
tercio@0 7 -- Pretend like loaded libstub is old and doesn't have :IterateLibraries
tercio@0 8 assert(LibStub.minor)
tercio@0 9 LibStub.minor = LibStub.minor - 0.0001
tercio@0 10 LibStub.IterateLibraries = nil
tercio@0 11
tercio@0 12 loadfile("../LibStub.lua")()
tercio@0 13
tercio@0 14 assert(type(LibStub.IterateLibraries)=="function")
tercio@0 15
tercio@0 16
tercio@0 17 -- Now pretend that we're the same version -- :IterateLibraries should NOT be re-created
tercio@0 18 LibStub.IterateLibraries = 123
tercio@0 19
tercio@0 20 loadfile("../LibStub.lua")()
tercio@0 21
tercio@0 22 assert(LibStub.IterateLibraries == 123)
tercio@0 23
tercio@0 24
tercio@0 25 -- Now pretend that a newer version is loaded -- :IterateLibraries should NOT be re-created
tercio@0 26 LibStub.minor = LibStub.minor + 0.0001
tercio@0 27
tercio@0 28 loadfile("../LibStub.lua")()
tercio@0 29
tercio@0 30 assert(LibStub.IterateLibraries == 123)
tercio@0 31
tercio@0 32
tercio@0 33 -- Again with a huge number
tercio@0 34 LibStub.minor = LibStub.minor + 1234567890
tercio@0 35
tercio@0 36 loadfile("../LibStub.lua")()
tercio@0 37
tercio@0 38 assert(LibStub.IterateLibraries == 123)
tercio@0 39
tercio@0 40
tercio@0 41 print("OK")