Skip to content

Decaf specs - #4

Merged
savetheclocktower merged 6 commits into
masterfrom
decaf-specs
Sep 9, 2026
Merged

Decaf specs#4
savetheclocktower merged 6 commits into
masterfrom
decaf-specs

Conversation

@savetheclocktower

Copy link
Copy Markdown

Now the specs are in a normal language.

Opened as draft because it depends on #3; will take out of draft once it lands.

@savetheclocktower
savetheclocktower marked this pull request as ready for review September 9, 2026 00:14
@savetheclocktower

Copy link
Copy Markdown
Author

OK, since this is basically mechanical, I'll probably land this PR soon. Mainly just wanted to ensure CI was green!

@savetheclocktower

Copy link
Copy Markdown
Author

Whoa! Moved a helper function and converted it from an expression (var buildSpellChecker = function () {...}) to a function statement (function buildSpellChecker() {...})… and promptly broke 13 specs.

The specs test everything with both the native spellchecker for each platform and hunspell… but the fact that it used a function expression meant that the [true, false] loop in practice tested only the false condition. Because the old version used var, it wasn't block-scoped; it was hoisted out of the loop. Changing var to let would've had the same effect.

So the specs were passing because they weren't testing hunspell! Luckily, 10 of the 13 failures related to using hunspell were because the spec did not set a language first — which doesn't actually happen as part of our usage of this library in Pulsar, so it was easy to get them to pass once we set a language.

The other three failures were due to poor guards. One spec purposefully tests macOS native spellchecker behavior, but guarded only on process.platform === 'darwin', so could never have passed in the hunspell branch. Now we guard on the specific spell-checking adapter rather than simply the platform. Another spec described “returns nothing for a pair of 257 1-byte character strings with encoding,” but didn't test that; it tested two-byte strings in a way that contradicted its sibling test as well as its own description. Restoring the clear intent fixed the test.

These specs were broken in the CoffeeScript spec file, so they must've been broken for years.

@savetheclocktower

Copy link
Copy Markdown
Author

Oh, also: added some extra specs for the singleton pattern — which previously was not tested because the tests always constructed a new Spellchecker instance.

@savetheclocktower
savetheclocktower merged commit b0e06d3 into master Sep 9, 2026
3 checks passed
@savetheclocktower
savetheclocktower deleted the decaf-specs branch September 9, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant