Skip to content

Commit

Permalink
Add helpers for branch detection, fix angle skips
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonsturgeon committed Jun 27, 2024
1 parent 389a3ab commit 7265985
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions lua/autorun/gmod_tests_init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include( "gmod_tests/sh_init.lua" )
7 changes: 7 additions & 0 deletions lua/gmod_tests/sh_init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Helpers and utilities for the gmod_tests test suite
-- (TODO: Do these belong somewhere else)
AddCSLuaFile()

local jitVersion = jit.version
IS_BASE_BRANCH = jitVersion == "LuaJIT 2.0.4"
IS_64BIT_BRANCH = jitVersion == "LuaJIT 2.1.0-beta3"
8 changes: 4 additions & 4 deletions lua/tests/gmod/globals/angle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ return{
},{
-- https://github.com/Facepunch/garrysmod-issues/issues/5922#issuecomment-2194156039
name = "Nil pitch returns 0, 0, 0 (base)",
when = BRANCH == "unknown",
when = IS_BASE_BRANCH,
func = function()
local angle = Angle( nil, 10, 22 )
expect( angle.pitch ).to.equal( 0 )
Expand All @@ -88,7 +88,7 @@ return{
},{
-- https://github.com/Facepunch/garrysmod-issues/issues/5922#issuecomment-2194156039
name = "Nil pitch falls back to 0 (x86-64)",
when = BRANCH == "x86-64",
when = IS_64BIT_BRANCH,
func = function()
local angle = Angle( nil, 10, 22 )
expect( angle.pitch ).to.equal( 0 )
Expand All @@ -98,7 +98,7 @@ return{
},{
-- https://github.com/Facepunch/garrysmod-issues/issues/5922#issuecomment-2194156039
name = "Table pitch returns 0, 0, 0 (base)",
when = BRANCH == "unknown",
when = IS_BASE_BRANCH,
func = function()
local angle = Angle( { "test" }, 10, 22 )
expect( angle.pitch ).to.equal( 0 )
Expand All @@ -108,6 +108,7 @@ return{
},{
-- https://github.com/Facepunch/garrysmod-issues/issues/5922#issuecomment-2194156039
name = "Table pitch falls back to 0 (x86-64)",
when = IS_64BIT_BRANCH,
func = function()
local angle = Angle( { "test" }, 10, 22 )
expect( angle.pitch ).to.equal( 0 )
Expand Down Expand Up @@ -189,6 +190,5 @@ return{
end
},
--#endregion

}
}

0 comments on commit 7265985

Please sign in to comment.