* Delete dead code from strings.ncl
* Split stdlib_string.ncl into multiple test files
This commit splits the monolithic stdlib string test file into
multiple smaller files, roughly split according to "domain" behaviour.
It also adds some new test cases in places where the coverage seemed
a little thin.
* Maintain extended grapheme cluster abstraction in `string.split`
This commit re-implements `string.split` so that extended grapheme
clusters are never broken up, even if the separator is included
within.
* Return extended grapheme clusters from `string.characters`
* Remove `string.codepoint` and `string.from_codepoint`
These functions break the extended grapheme cluster abstraction,
and don't have equivalents in the Nix language, so we've decided
to remove them.
* Use grapheme cluster indices in string.substring
* Ensure `string.replace` doesn't separate extended grapheme clusters
* `string.contains` should check entire grapheme clusters
This updates the implementation of `string.contains` to avoid returning
true if the string we're searching for only exists as part of a larger
extended grapheme cluster.
* Refactor Nickel string implementation to `term::string` module
* Update stdlib documentation
First draft of implementing Nickel numbers using arbitrary precision
rationals instead of 64-bits float. The rationale is to provide exact
precision for common arithmetic operations (understand addition,
division, subtraction, raising to an integer power, modulo), as opposed
to floats, that can incur rounding error on sometimes common decimal
values.
Some operations do need rounding: raising to a non-integer power, as
well as representation as a string (to_string/serialization).
* Update regex crate to 1.7
We want to use the regex filtering feature of the insta snapshot testing
library. That has a dependency on a newer version of the regex crate
than Nickel currently does, so this commit updates the Nickel version to
a more recent compatible version.
* Add insta dependency
* Add cargo-insta to dev shells
* Add snapshot testing infrastructure
This uses the insta crate to implement snapshot testing.
Each snapshot test invokes the debug nickel binary with some set of
arguments, then captures the output & compares it to a file in the
snapshots directory
* Add nixpkgs-fmt to dev shell
This makes it possible to easily reformat flake.nix from within a dev
shell.
* Update HACKING.md
* Add snapshot testing README
Previously `%str_length%` was returning the number of bytes in the Rust
`String` storage, which lead to unexpected results.
This commit uses the `unicode-segmentation` crate to instead count the
number of extended grapheme clusters in the string. This means that even
complex emoji comprised of multiple characters, but visually rendering
as one, get counted as just one character.
One potential downside to this is that this isn't consistent with how
other standard library functions (such as splitting a string) currently
work, however it also wasn't consistent before, and this change at least
moves things in the right direction
* Add test-generator dependency
* Use test-generator to simplify pass test file
This commit uses the test-generator library to automatically generate a
set of integration tests from any `.ncl` file in the
`tests/integration/pass` directory.
As a consequence, simply adding a new file to that directory is
sufficient to add a new test case.
This also meant that the non-test files, like the assertion library and
files that are used to test importing, were moved to a '/lib' directory
so test-generator doesn't pick them up.
Version 0.2.74 no longer builds with recent `nixpkgs` because of openssl.
* Update wasm-bindgen from 0.2.74 to 0.2.83
* Refactor `wasm-bindgen-cli` overlay to override Nixpkgs' definition, rather
than build the package from Github
* Remove the no longer used `wasm-bindgen-api-Cargo.lock` file
* Add comments about the hidden coupling between `wasm-bindgen` in `Cargo.toml`
and `wasm-bindgen-cli` in `flake.nix`
Fix issue #596. The main problem was a `token` annotation instead of a
`regex` in the lexer. Since this bug was preventing the corresponding
code path in the lexer to not be triggered, this patch also fixes a few
other small issues that appeared along the way. Bump the `logos`
dependency and add a regression test as well.
codespan_lsp is to-date not compatible with lsp-types >0.88
lsp_types is already at 0.91
codespan_lsp has already updated the bounds upstream but did not not
yet update on crates.io
Cargo install failed because the minimad dependency was duplicated, and
made an import ambiguous (it was both in Cargo.toml and imported by
termimad). Took the occasion to update other dependencies.