λ PLT Games

Testing the Waters January 2013

Description

Now that we've made an impractical language, let's stop the academic elitism and build something for the Real World™.

Automated testing is extremely important for finding bugs. Even for formally verified software. An example is automated unit testing, which tests an individual part of the code, such as a method:

assert(adder.add(1, 1) == 2);

Automated tests are generally written in the same language as the implementation code, in a separate module, using a test framework and test runner.

Despite its importance, testing is almost never the primary concern for language designers.

Until now.

The goal of this theme is to create a language that is somehow related to automated testing. This could be interpreted however you like, for example:

Go on and make testing better!

Inspiration

D
class Sum {
  int add(int x, int y) { return x + y; }

  unittest
  {
    Sum sum = new Sum;
    assert(sum.add(3,4) == 7);
    assert(sum.add(-2,0) == -2);
  }
}
Cobra
class Utils
    shared
        def countChars(s as String, c as char) as int
            """
            Returns the number of instances of c in s.
            """
            test
                assert Utils.countChars('', c'x') == 0
                assert Utils.countChars('x', c'x') == 1
                assert Utils.countChars('X', c'x') == 0  # case sensitive
                assert Utils.countChars(' ! ! ', c'!') == 2
            body
                count = 0
                for ch in s
                    if c == ch
                        count += 1
                return count
Noop
import noop.Console;
import noop.FakeConsole;

class HelloWorld(Console c) {
  Int main(List args) {
    c.println("Hello tests!");
    return 1;
  }

  test "prints hello" scope (Console -> FakeConsole) {
    main(List()) should equal(1);
    c.asInstance(FakeConsole).getPrintedText() should contain("Hello tests!"));
  }
}

Resources

Criteria

Innovation

Does this language introduce you to any new concepts? Does this seem like a unique language?

Completeness

Does the implementation of this language work as intended? Does it lack many bugs?

Theme application

Does the language fit the theme? Does it satisfy the constraints in the description?

Submissions

vigil

by munificent

Innovation:
    Completeness:
      Theme:
        plt-banker

        by elitheeli

        Innovation:
          Completeness:
            Theme:
              11rank

              by morefreeze

              Innovation:
                Completeness:
                  Theme:
                    isitoq

                    by gatesphere

                    Innovation:
                      Completeness:
                        Theme:
                          pltgames-testoy

                          by mdg

                          Innovation:
                            Completeness:
                              Theme:
                                pipo

                                by zayac

                                Innovation:
                                  Completeness:
                                    Theme:
                                      symplex

                                      by greedy

                                      Innovation:
                                        Completeness:
                                          Theme:
                                            fortholito

                                            by tormaroe

                                            Innovation:
                                              Completeness:
                                                Theme:
                                                  bianca

                                                  by aaditmshah

                                                  Innovation:
                                                    Completeness:
                                                      Theme:
                                                        constrained

                                                        by fwg

                                                        Innovation:
                                                          Completeness:
                                                            Theme: