redo version checks

akkartik
Dec 7, 2023, 4:15 AM
Z2VZTIXYXUZXF4ZUVG54IOIRSMBGUZJZ2RTBPYOJC7NWBOUFU6YAC

Dependencies

  • [2] APX2PY6G stop tracking wallclock time
  • [3] HR6MLUTX show count of test failures
  • [4] N2NUGNN4 include a brief reference enabling many useful apps
  • [5] OLH6DPAD speculatively recommend new LÖVE v11.5 in all forks
  • [6] FE25XVZY yet another bugfix to the version check
  • [7] O5F6DNPG _yet another_ bugfix to the version check X-(
  • [8] AVTNUQYR basic test-enabled framework
  • [9] 6VJTQKW7 start supporting LÖVE v12
  • [10] YGCT2D2O start loading settings as applicable
  • [11] PESSMQBJ no, make sure to compute line width after screen dimensions
  • [12] KKMFQDR4 editing source code from within the app
  • [13] TSK2OXU2 .
  • [14] CUFW4EJL reorganize app.lua and its comments
  • [15] KMSL74GA support selections in the source editor
  • [16] WQOSZSUE warn on unused commandline args
  • [17] ORRSP7FV deduce test names on failures
  • [18] MHOUX5JF experiment: turn off JIT
  • [19] D2IADHMW link to default love.run for comparison
  • [20] 3QNOKBFM beginnings of a test harness
  • [21] HPVT467W initialize contains test state
  • [22] NEXUNNCF extract a function
  • [23] 5XQ4Y7NU reorg manual tests doc
  • [24] EWJZ6XHB better formatting
  • [25] 7SICLTED check for 'error' mode in a few more places
  • [26] FJIGUGEC bugfix: version check
  • [*] OTIBCAUJ love2d scaffold
  • [*] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing

Change contents

  • edit in reference.md at line 14
    [4.509]
    [4.509]
    * `Version` -- the running version of LÖVE as a string, e.g. '11.4'.
    * `Major_version` -- just the part before the period as an int, e.g. 11.
  • replacement in main.lua at line 75
    [8.31][8.31:198](),[8.198][5.20:112](),[5.112][8.282:776](),[8.282][8.282:776](),[8.115][8.82:88](),[8.776][8.82:88](),[8.186724][8.82:88](),[8.82][8.82:88](),[8.88][8.186725:186729]()
    function App.version_check()
    -- available modes: run, error
    Error_message = nil
    Error_count = 0
    -- we'll reuse error mode on load for an initial version check
    local supported_versions = {'11.5', '11.4', '12.0'} -- put the recommended version first
    local minor_version
    Major_version, minor_version = love.getVersion()
    Version = Major_version..'.'..minor_version
    if array.find(supported_versions, Version) == nil then
    Current_app = 'error'
    Error_message = ("This app doesn't support version %s; please use version %s. Press any key to try it with this version anyway."):format(Version, supported_versions[1])
    print(Error_message)
    -- continue initializing everything; hopefully we won't have errors during initialization
    end
    end
    [8.31]
    [8.8]
    function App.initialize_globals()
    Supported_versions = {'11.5', '11.4', '12.0'} -- put the recommended version first
    check_love_version_for_tests()
  • edit in main.lua at line 79
    [8.9][8.186730:186764]()
    function App.initialize_globals()
  • edit in main.lua at line 92
    [2.414]
    [8.1047]
    end
    function check_love_version_for_tests()
    if array.find(Supported_versions, Version) == nil then
    Unsupported_version = true
    -- warning to include in an error message if any tests failed
    Warning_before_tests = ("This app hasn't been tested with LÖVE version %s."):format(Version)
    end
  • edit in main.lua at line 102
    [8.1052]
    [8.187114]
    function App.love_version_check()
    if Unsupported_version then
    Current_app = 'error'
    Error_message = ("This app hasn't been tested with LÖVE version %s; please switch to version %s if you run into issues. Press any key to continue."):format(Version, Supported_versions[1])
    print(Error_message)
    -- continue initializing everything; hopefully we won't have errors during initialization
    end
    end
  • replacement in app.lua at line 11
    [8.54][7.0:22]()
    App.version_check()
    [8.54]
    [8.209765]
    Version, Major_version = App.love_version()
  • replacement in app.lua at line 15
    [8.209821][6.0:22]()
    App.version_check()
    [8.209821]
    [8.258]
    App.love_version_check() -- hack: we want to run this just the first time and not every time we bounce between 'run' and 'source'
  • edit in app.lua at line 89
    [8.5849]
    [8.209822]
    function App.love_version()
    local major_version, minor_version = love.getVersion()
    local version = major_version..'.'..minor_version
    return version, major_version
    end
  • replacement in app.lua at line 112
    [8.60589][3.33:131]()
    error(('There were %d test failures:\n\n%s'):format(#Test_errors, table.concat(Test_errors)))
    [8.60589]
    [8.60659]
    local error_message = ''
    if Warning_before_tests then
    error_message = Warning_before_tests..'\n\n'
    end
    error_message = error_message .. ('There were %d test failures:\n%s'):format(#Test_errors, table.concat(Test_errors))
    error(error_message)
  • replacement in Manual_tests.md at line 20
    [8.156][8.156:295]()
    - run with an unsupported version. Error message pops up and waits for a key. The app attempts to continue, and doesn't receive the key.
    [8.156]
    [7.23]
    - run with an untested version. Error message pops up and waits for a key. The app attempts to continue, and doesn't receive the key.
  • replacement in Manual_tests.md at line 33
    [8.211526][6.23:238]()
    * run with an unsupported version. Error message pops up and waits for a key. The app attempts to continue, and doesn't receive the key. Press ctrl+e to edit source. Source editor opens up without checking version.
    [8.211526]
    [8.211526]
    * run with an untested version. Error message pops up. Press a key. Text editor comes up, and doesn't receive the key. Press ctrl+e. Source editor opens up. Press ctrl+e. Text editor returns.
    * create a couple of spuriously failing tests. Run with an untested version. Error message includes message about untested version.