scarpe-team / scarpe

Scarpe - shoes but running on webview
Other
163 stars 28 forks source link

Error cleanup #449

Closed noahgibbs closed 11 months ago

noahgibbs commented 12 months ago

Description

Now that we have a PR for Niente, a do-nothing display library that doesn't have a ton of Webview incidental complexity, we can use it for Lacci testing.

I've started by doing a bit of an error cleanup. We want a Shoes::Errors namespace so that the online docs don't look so messy with a ton of random error classes mixed with everything else. We also want a bunch of Scarpe errors that are really in Shoes code to move into Shoes (see issue #440, which this doesn't fix, but helps.)

I also (again) got rid of that annoying backtrace printed to console on every successful run of the promises unit tests -- those started printing the whole backtrace again when I switched the tests to use the simple print logger instead of the complicated configurable logger.

Image(if needed, helps for a faster review)

Not actually an image, but here's what the Niente-based Lacci tests look like now for errors:

  def test_drawables_found_errors
    run_test_niente_code(<<~SHOES_APP, app_test_code: <<~SHOES_SPEC)
    Shoes.app do
      button "OK"
      button "Not OK"
    end
    SHOES_APP
    assert_raises Shoes::Errors::MultipleDrawablesFoundError do
      button()
    end
    assert_raises Shoes::Errors::NoDrawablesFoundError do
      edit_line()
    end
    SHOES_SPEC
  end

Very pretty, I think!

Checklist