Tests, JSON support, and HTTP requests over SSL

September 28, 2016 by Phil Eaton

It's been a while since I last posted an update on Ponyo and I've got some really exciting features to announce. In the past few months, we've added a simple testing framework and begun writing tests. We've added a JSON parsing and marshalling functions to help transform JSON strings into Standard ML records. And in the last week, I added rudimentary support for active SSL sockets by hooking into OpenSSL.

The test framework simply collects lists of boolean values and indicates where one is false. These tests can contain other groups of tests that are collected and reported back as a boolean. See the String test module for an example. Using this method I found and fixed a number of bugs in the String module. The Ponyo repo is now hooked up to Travis CI so pull requests can begin to be tested automatically before being merged.

Right now, the test modules must be collected manually. The goal is to replace this with a test runner that calls a function in every .sml file in a directory.

With the addition of JSON parsing and HTTP clients talking over SSL, you can finally begin one of the things I've been most excited for: consuming real APIs. Check out this example that uses these recent additions to parse and print out a list of Linode datacenters.

Disclaimer: even though this stuff is functional, it's just barely so. Don't use this for anything serious.