love.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. -- love
  2. -- tests for the main love hooks + methods, mainly just that they exist
  3. --------------------------------------------------------------------------------
  4. --------------------------------------------------------------------------------
  5. ------------------------------------METHODS-------------------------------------
  6. --------------------------------------------------------------------------------
  7. --------------------------------------------------------------------------------
  8. -- love.getVersion
  9. love.test.love.getVersion = function(test)
  10. local major, minor, revision, codename = love.getVersion()
  11. test:assertGreaterEqual(0, major, 'check major is number')
  12. test:assertGreaterEqual(0, minor, 'check minor is number')
  13. test:assertGreaterEqual(0, revision, 'check revision is number')
  14. test:assertTrue(codename ~= nil, 'check has codename')
  15. end
  16. -- love.hasDeprecationOutput
  17. love.test.love.hasDeprecationOutput = function(test)
  18. local enabled = love.hasDeprecationOutput()
  19. test:assertEquals(true, enabled, 'check enabled by default')
  20. end
  21. -- love.isVersionCompatible
  22. love.test.love.isVersionCompatible = function(test)
  23. local major, minor, revision, _ = love.getVersion()
  24. test:assertTrue(love.isVersionCompatible(major, minor, revision), 'check own version')
  25. end
  26. -- love.setDeprecationOutput
  27. love.test.love.setDeprecationOutput = function(test)
  28. local enabled = love.hasDeprecationOutput()
  29. test:assertEquals(true, enabled, 'check enabled by default')
  30. love.setDeprecationOutput(false)
  31. test:assertEquals(false, love.hasDeprecationOutput(), 'check disable')
  32. love.setDeprecationOutput(true)
  33. end
  34. -- love.errhand
  35. love.test.love.errhand = function(test)
  36. test:assertTrue(type(love.errhand) == 'function', 'check defined')
  37. end
  38. -- love.run
  39. love.test.love.run = function(test)
  40. test:assertTrue(type(love.run) == 'function', 'check defined')
  41. end