https://toitlang.org/ logo
Join Discord
Powered by
# packages
  • k

    kasperl

    02/24/2025, 2:14 PM
    Hard to tell with the repo being private 🙂
  • a

    addshore

    02/24/2025, 2:14 PM
    oh lol
  • k

    kasperl

    02/24/2025, 2:15 PM
    But I can make an educated guess and say no.
  • a

    addshore

    02/24/2025, 2:15 PM
    should load now 🙂
  • k

    kasperl

    02/24/2025, 2:17 PM
    So you'd like to dynamically find all methods based on name or some such? I can't think of any reasonable way of doing that.
  • k

    kasperl

    02/24/2025, 2:18 PM
    (no reflection support)
  • a

    addshore

    02/24/2025, 2:18 PM
    indeed
  • a

    addshore

    02/24/2025, 2:18 PM
    yeah, the only case i would want to use it is testing really
  • k

    kasperl

    02/24/2025, 2:18 PM
    Now, we could have a test runner that makes this easier, but we don't have that yet.
  • a

    addshore

    02/24/2025, 2:18 PM
    an equally usefull feature for CI would be to ensure all defined functions are used
  • a

    addshore

    02/24/2025, 2:23 PM
    Well, this will do as my test runner for now 🙂 https://github.com/lightbug-io/toit-coordinate/blob/main/Makefile
  • f

    floitsch

    02/24/2025, 2:24 PM
    It doesn't fully fit your purpose, but in the past we did similar things using the LSP client/server. It gives you a nicely structured way of the sources. It doesn't give you a good way to call the functions, though.
  • f

    floitsch

    02/24/2025, 2:24 PM
    Also the LSP client isn't yet in its own package, but in the Toit repository.
  • f

    floitsch

    02/24/2025, 2:25 PM
    We do something similar. Just with CMake. https://github.com/toitlang/pkg-fs/blob/main/tests/CMakeLists.txt https://github.com/toitlang/pkg-http/blob/main/tests/CMakeLists.txt ...
  • f

    floitsch

    02/24/2025, 2:26 PM
    We then use the
    ctest
    to run the tests.
  • f

    floitsch

    02/24/2025, 2:27 PM
    We got so used to it, that we never implemented a nice Toit-based testing framework. Mikkel did something like that, though. https://pkg.toit.io/package/github.com%2Fmikkeldamsgaard%2Fpkg-test@v1.1.0
  • f

    floitsch

    02/24/2025, 2:27 PM
    And his package uses the LSP client.
  • a

    addshore

    02/24/2025, 2:29 PM
    I'll probabyl experiment with using that test pkg at some stage
  • k

    kasperl

    02/24/2025, 2:30 PM
    You could probably use
    import expect show *
    and get some helpers for validating results.
  • k

    kasperl

    02/24/2025, 2:32 PM
    ... and you could consider abstracting over your test functions like this:
    Copy code
    test "distance-to-coord-1km": test-distance-to-coord-1km
    so you have a chance to print the failures and successes in one place with some catch-magic.
  • f

    floitsch

    02/24/2025, 2:39 PM
    unfortunately you can't catch
    expect
    with a
    catch
    clause.
  • k

    kasperl

    02/24/2025, 2:40 PM
    Does it exit? It probably does.
  • f

    floitsch

    02/24/2025, 2:40 PM
    yes.
  • k

    kasperl

    02/24/2025, 2:40 PM
    https://github.com/toitlang/toit/blob/698d1f0c3ac2f2d8cdadecbbeebc149ed6c09a09/lib/expect.toit#L23
  • f

    floitsch

    03/03/2025, 4:15 PM
    New version of the MQTT package released: https://pkg.toit.io/package/github.com%2Ftoitware%2Fmqtt@v2.12.0 @bmentink , the
    SimpleClient
    might be what you want. @kaxori you could also be interested.
  • a

    addshore

    05/21/2025, 9:18 AM
    So, it looks like the indexing of the packages site could be improved a little maybe? Searching for
    toit lightbug
    or example The top result specifically points to
    0.3.0
    , and this leads to people installing an old version I guess ideally only the main lannding page should be indexed? https://www.google.com/search?q=toit+lightbug&sca_esv=340a42e2eabdb65d&rlz=1C1GCCU_en&ei=6JktaMGcNpKDhbIPyL6FiAU&ved=0ahUKEwjBsOeNnbSNAxWSQUEAHUhfAVEQ4dUDCBA&uact=5&oq=toit+lightbug&gs_lp=Egxnd3Mtd2l6LXNlcnAiDXRvaXQgbGlnaHRidWcyCBAAGIAEGKIEMggQABiABBiiBDIIEAAYogQYiQUyCBAAGKIEGIkFMggQABiABBiiBEh-UABYAHAAeAGQAQCYAXOgAXOqAQMwLjG4AQPIAQD4AQGYAgGgAneYAwCSBwMwLjGgB-cCsgcDMC4xuAd3wgcDMi0xyAcD&sclient=gws-wiz-serp https://cdn.discordapp.com/attachments/1341784634891173908/1374677597761568788/image.png?ex=682eebc7&is=682d9a47&hm=6a6686e78a0aad5becb0e6aba34680addaa1870c1a6b3478bf141aff64c39fdd&
  • f

    floitsch

    05/21/2025, 12:01 PM
    pff. All of these pages are auto-generated, and I'm not sure how to tell Google to only index the latest version. But I agree. That's annoying.
  • f

    floitsch

    05/21/2025, 12:01 PM
    Especially with
    0.x.y
    versions where
    pkg update
    doesn't change the package (since that could be breaking).
  • a

    addshore

    05/21/2025, 12:04 PM
    Either only the latest version, or even better maybe just the one that does that's a version specified. Where is it generated? Can alter the indexing my altering head tags
  • f

    floitsch

    05/21/2025, 12:17 PM
    It's a combo of https://github.com/toitware/web-tpkg and https://github.com/toitware/tpkg