1. 14 Nov, 2020 2 commits
  2. 30 Oct, 2020 7 commits
  3. 20 Oct, 2020 2 commits
    • Eric Myhre's avatar
      codegen: make error info available when tuples process data that is too long. · 2461bba8
      Eric Myhre authored
      This requires introducing an error-carrying NodeAssembler,
      because the AssembleValue methods don't have the ability to return errors themselves.
      
      AssembleValue methods have not needed to return errors before!
      Most lists don't have any reason to error: out of our whole system,
      it's only struct-with-tuple-representation that can have errors here,
      due to tuples having length limits.
      AssembleValue for maps doesn't have a similar challenge either,
      because key invalidity can always be indicated by errors returned from
      the key assembly process.
      
      I'm not a big fan of this diff -- error carrying thunks like this are
      ugly to write and they're also pretty ugly to use -- but I'm not sure
      what would be better.  ListAssembler.AssembleValue returning an error?
      Turning ListAssembler into a two phase thing, e.g. with an Advance
      method that fills some of the same role as AssembleKey does for maps,
      and gives us a place to return errors?
      2461bba8
    • Eric Myhre's avatar
      329252db
  4. 04 Oct, 2020 1 commit
  5. 10 Sep, 2020 8 commits
    • Daniel Martí's avatar
      schema/gen/go: make all top-level tests parallel · 35003242
      Daniel Martí authored
      They do quite a lot of work, including setting up a type system,
      generating Go code, and building it.
      
      This package is by far the slowest to test. On a warm cache, 'go test
      -count=1 ./...' shows all packages under 0.2s, while this one sits at
      ~1.5s.
      
      1.5s is not unreasonable with a warm cache, but we can bring that down
      to 0.6s on my quad-core laptop by just making all tests parallel. Note
      that sub-tests aren't parallel for now, since there are multiple layers
      of them and I'm not sure I even follow what's going on.
      
      Mac is also disabled for the time being, since it seems to time out too
      often.
      35003242
    • Daniel Martí's avatar
      all: don't use buffers where readers suffice · 8e26c7e2
      Daniel Martí authored
      Buffers are not a good option for tests if the other side expects a
      reader. Otherwise, the code being tested could build assumptions around
      the reader stream being a single contiguous chunk of bytes, such as:
      
      	_ = r.(*bytes.Buffer).Bytes()
      
      This kind of hack might seem unlikely, but it's an easy mistake to make,
      especially with APIs like fmt which automatically call String methods.
      
      With bytes.Reader and strings.Reader, the types are much more
      restricted, so the tests need to be more faithful.
      8e26c7e2
    • Eric Myhre's avatar
      cae2ca2b
    • Eric Myhre's avatar
      daffd0be
    • Eric Myhre's avatar
      Prefer readers to buffers. · 4d37a0ff
      Eric Myhre authored
      4d37a0ff
    • Eric Myhre's avatar
      Align several more bits of schema-schema json with the drifts made by the... · 2b7b3f0d
      Eric Myhre authored
      Align several more bits of schema-schema json with the drifts made by the programatic type construction.
      
      The gap between these isn't within the reach of this test to probe.
      (Yet.  We'll get there.  It's not terribly much further.)
      2b7b3f0d
    • Eric Myhre's avatar
      Add test that unmarshals schema-schema json into the codegen'd types. · da502e49
      Eric Myhre authored
      This is a somewhat altered schema-schema document, as commented.
      Some of those alterations might get upstreamed; I'll be making other
      PRs to the upstream specs repo to discuss that.
      da502e49
    • Eric Myhre's avatar
      Some fixups to the schema-schema codegen demo: · 871e52c7
      Eric Myhre authored
      - it now uses kinded unions (since those are supported now; they
        weren't yet the last time we touched this demo!).
      
      - a few typos are fixed (field names; in one case, a place that must
        support type names as well as inline defns).
      
      - added the 'Schema' type at the very top!  this is what parsing the
        schema-schema starts with!
      871e52c7
  6. 05 Sep, 2020 7 commits
    • Eric Myhre's avatar
      Convert kinded union tests to use new helpers. · 44513d62
      Eric Myhre authored
      This is probably now one of the nicer (directly-exercised) examples we
      have for how the type-level and representation-level views of data can
      differ with the use of schemas.
      44513d62
    • Eric Myhre's avatar
    • Eric Myhre's avatar
      Convert more union tests. · d3be0580
      Eric Myhre authored
      Interesting to note that this causes the go-wish library to drop out of
      the imports list entirely.
      d3be0580
    • Eric Myhre's avatar
      Convert union tests to use the new test helpers; fix iterators. · 7fb84adf
      Eric Myhre authored
      The increased coverage found an infinite loop in iterators, so the
      fix for this is included in this commit.
      7fb84adf
    • Eric Myhre's avatar
      e0e89d72
    • Eric Myhre's avatar
      less atrocious testcase names. · 0520d521
      Eric Myhre authored
      Though in general, letting golang's test system replace spaces and
      other unusual characters with underscores has very little downside,
      here, the resulting "_--_" is quite unpleasant on the eyes.
      
      Change things to use TitleCase.
      0520d521
    • Eric Myhre's avatar
      New testcase system for exercising typed nodes; Revamp struct tests with it. · 5d732d47
      Eric Myhre authored
      This new system focuses on table-driven tests, and leans heavily upon
      json as a shorthand for expressing fixtures.
      
      It also makes a great deal more effort to exercise the different
      features of nodes (and their paired representation nodes) from all
      directions at once for each test datum, rather than requring that all
      be written out manually.
      
      The result is that the struct tests we've renovated have a lovely
      diffstat shrinkage: 111 insertions, 299 deletions...
      
      And yet the smaller line count results in *more* coverage.
      
      (Okay, the linecount increase for the testcase structure and helper
      methods is much bigger than the savings in fixture size... but,
      only *so far*.  I assume this will continue to pay off in the future.)
      
      Relatedly: a bug in struct map representations has been fixed.
      (It was the sibling of 5f589653, embarassingly.)  Thank goodness we now
      get proper coverage of this area.
      
      There's a few TODOs left to further expand the exercises, but those
      can slot in easily in subsequent commits.  Same goes for further
      expansion of usage of this new system.
      5d732d47
  7. 02 Sep, 2020 1 commit
  8. 22 Aug, 2020 1 commit
  9. 19 Aug, 2020 1 commit
  10. 05 Aug, 2020 1 commit
    • Eric Myhre's avatar
      Remainder of gen for kinded union representations. · ecb4744c
      Eric Myhre authored
      The AssignNode method is now supplied; and the previous hacky shrug
      regarding switch statements with no applicable cases also had to go.
      (Turns out that the no-applicable-cases thing coincidentally worked
      for the "embedall" internal implementation mode; but didn't fly for
      the "interface" internal style, because that would end up with
      variable declarations made but not referenced.  Harrumph.)
      ecb4744c
  11. 04 Aug, 2020 5 commits
  12. 30 Jul, 2020 4 commits