Skip to content

v2.2.0 - GML 2020 Update

Compare
Choose a tag to compare
@dicksonlaw583 dicksonlaw583 released this 20 Sep 15:49

This is a major release for GML 2020 updates in GMS 2.3. If you are upgrading from an older release, please read the changes carefully!

Changes

  • GMASSERT_ENABLED and GMASSERT_TOLERANCE are now configured in a script resource named __GMA_SETTINGS__.
  • Debug values now use standard GML notation for most basic types (Examples: "Hello world!" 365 -infinity [1, 2, 3] {x: 5, y: 6, z: 7}). See the Wiki or helpfile for details.
  • Because GMS 2.3 removes the built-in distinction between 1D and 2D arrays (i.e. 2D arrays are now just nested 1D arrays), the following assertions no longer support 2D arrays:
    • assert_contains(got, content, [msg])
    • assert_contains_exact(got, content[msg])
    • assert_doesnt_contain(got, content, [msg])
    • assert_doesnt_contain_exact(got, content, [msg])
  • New _2d-suffixed assertions have been added to handle containment-type assertions in 2D arrays. These new assertions also support grids.
    • assert_contains_2d(got, content, [msg])
    • assert_contains_exact_2d(got, content[msg])
    • assert_doesnt_contain_2d(got, content, [msg])
    • assert_doesnt_contain_exact_2d(got, content, [msg])

Additions

  • Support for struct (constructor-based and literal-based) and method types
    • assert_is_struct(got, [msg]) / assert_isnt_struct(got, [msg])
    • assert_is_method(got, [msg]) / assert_isnt_method(got, [msg])
    • assert_has_method(got, key, [msg]) / assert_doesnt_have_method(got, key, [msg])
  • Support for arbitrary type checking (built-in types and constructor-named types)
    • assert_is_instance_of(got, typeName, [msg]) / assert_isnt_instance_of(got, typeName, [msg])
  • Support for catching exceptions thrown by functions
    • Throw-free (or not): assert_throwless(func, [msg]) / assert_not_throwless(payload, [msg])
    • Throw specific type (or not): assert_throws_instance_of(payload, typeName, [msg]) / assert_doesnt_throw_instance_of(payload, typeName, [msg])
    • Throw specific value (or not): assert_throws(payload, thrown, [msg]) / assert_doesnt_throw(payload, thrown, [msg])
  • Support debug values for newer types such as fixed-point integers, pointers and strict booleans (Example: int64(642) ptr($3f2a) bool(true))
  • Support for checking keys in a map (also works for structs)
    • assert_has_key(got, key, [msg]) / assert_doesnt_have_key(got, key, [msg])
  • Aliases for checking undefined:
    • assert_is_undefined(got, [msg]) / assert_isnt_undefined(got, [msg])