Mercurial > wow > askmrrobot
comparison Libs/LibStub/tests/test4.lua @ 3:e75889a45130
Attempt to fix curse
| author | Adam tegen <adam.tegen@gmail.com> |
|---|---|
| date | Tue, 20 May 2014 23:30:59 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 2:165752e9b22a | 3:e75889a45130 |
|---|---|
| 1 debugstack = debug.traceback | |
| 2 strmatch = string.match | |
| 3 | |
| 4 loadfile("../LibStub.lua")() | |
| 5 | |
| 6 | |
| 7 -- Pretend like loaded libstub is old and doesn't have :IterateLibraries | |
| 8 assert(LibStub.minor) | |
| 9 LibStub.minor = LibStub.minor - 0.0001 | |
| 10 LibStub.IterateLibraries = nil | |
| 11 | |
| 12 loadfile("../LibStub.lua")() | |
| 13 | |
| 14 assert(type(LibStub.IterateLibraries)=="function") | |
| 15 | |
| 16 | |
| 17 -- Now pretend that we're the same version -- :IterateLibraries should NOT be re-created | |
| 18 LibStub.IterateLibraries = 123 | |
| 19 | |
| 20 loadfile("../LibStub.lua")() | |
| 21 | |
| 22 assert(LibStub.IterateLibraries == 123) | |
| 23 | |
| 24 | |
| 25 -- Now pretend that a newer version is loaded -- :IterateLibraries should NOT be re-created | |
| 26 LibStub.minor = LibStub.minor + 0.0001 | |
| 27 | |
| 28 loadfile("../LibStub.lua")() | |
| 29 | |
| 30 assert(LibStub.IterateLibraries == 123) | |
| 31 | |
| 32 | |
| 33 -- Again with a huge number | |
| 34 LibStub.minor = LibStub.minor + 1234567890 | |
| 35 | |
| 36 loadfile("../LibStub.lua")() | |
| 37 | |
| 38 assert(LibStub.IterateLibraries == 123) | |
| 39 | |
| 40 | |
| 41 print("OK") |
