CFC-Servers / GLuaTest

An exciting and nimble unit testing framework for GLua projects
https://discord.gg/epJK9Xx3pc
GNU General Public License v3.0
51 stars 2 forks source link

Add some way to aggregate expectation failures within a block #45

Open brandonsturgeon opened 1 year ago

brandonsturgeon commented 1 year ago

Sometimes if you need to run a lot of expectations, you want to know about all of the failures rather than just the first one.

Ruby's RSpec accomplishes this like so:

it "returns success response from stripe" do
  aggregate_failures "stripe response" do
    expect(refund.amount).to eq 100
    expect(refund.status).to eq "succeeded"
    expect(refund.id).to start_with "re_"
  end
end

Ruby has the blessing of lots of block contexts, but we could maybe mimic that feature like so:

aggregateFailures( "stripe response", function()
    expect( refund.amount ).to.equal( 100 )
    expect( refund.status ).to.equal( "succeeded" )
    expect( string.StartsWith( refund.id, "re_" ) ).to.beTrue()
end )

No doubt a nightmare to implement in the current runner code (bump on https://github.com/CFC-Servers/GLuaTest/issues/24)