Mercurial > wow > askmrrobot
comparison libs/LibStub/tests/test4.lua @ 0:ec731d2fe6ba
Version 1.2.12.0
| author | Adam tegen <adam.tegen@gmail.com> | 
|---|---|
| date | Tue, 20 May 2014 21:43:23 -0500 | 
| parents | |
| children | 
   comparison
  equal
  deleted
  inserted
  replaced
| -1:000000000000 | 0:ec731d2fe6ba | 
|---|---|
| 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") | 
