bun icon indicating copy to clipboard operation
bun copied to clipboard

Quick unit tests

Open alexkuz opened this issue 2 years ago • 0 comments

The idea here is to have (some) unit tests use minimum dependencies so that it can be quickly compiled and run.

  • packages added: global, logger, js_ast, with corresponding stubs for tests;
  • added make quick-tests command for a set of unit tests (see src/__quick_tests.zig);
  • some not-so-quick tests are in src/__all_quick_tests.zig;
  • refactoring:
    • __global.zig removed, Global struct moved to global.zig;
    • UpdateRequest moved out from install.zig;
    • all allocators moved to src/allocators/, allocators.zig renamed to data_structures.zig (not directly related to tests, I just find it less confusing, can revert this though);
    • some global utility functions moved to global_utils.zig;
  • bugs fixed:
    • SizeFormatter will print 0.51 KB instead of 1 KB for fmt.size(513) (special thanks to Zig anonymous struct literal);
    • indexOfNotChar will find a char (that's not equal to provided) as intended;
  • added tests for:
    • SizeFormatter
    • range
    • copy
    • scoped package test for UpdateRequests.parse
  • avoid using brew --prefix <FORMULA> on MacOS, it's very slow.

alexkuz avatar Jul 28 '22 08:07 alexkuz