wxMaxima
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
test_MaximaTokenizer.cpp File Reference

Regression tests for GH #898: an identifier split by an escaped newline ("\<newline>") used to be tokenized (and therefore syntax-highlighted) as two unrelated halves – the first not even classified at all (it fell through the function/variable/operator/keyword lookups entirely), the second starting over as if it were a brand new, independent identifier. More...

#include <wx/app.h>
#include <wx/bitmap.h>
#include <wx/dcmemory.h>
#include <wx/log.h>
#include "Configuration.h"
#include "MaximaTokenizer.h"
#include "worksheet/Worksheet.h"
#include <cstdlib>
#include <unistd.h>
#include <catch2/catch.hpp>
Include dependency graph for test_MaximaTokenizer.cpp:

Data Structures

class  TestApp
 

Functions

 SCENARIO ("A plain identifier (no escapes) tokenizes as a single styled token")
 
 SCENARIO ("An identifier split by an escaped newline stays one logical, consistently-styled name")
 
 SCENARIO ("A hardcoded keyword split by an escaped newline is still recognized as one")
 
 SCENARIO ("A function name split by an escaped newline is still recognized as a function call")
 
 SCENARIO ("An ordinary escaped character in an identifier is unaffected by the fix")
 
 SCENARIO ("Symbols Maxima knows as aliases are passed on, separated from their neighbours")
 
 SCENARIO ("Symbols inside strings are left alone")
 
 SCENARIO ("What an alias can't express is still translated by wxMaxima")
 
 SCENARIO ("A square root's simple argument gets parenthesis")
 
 wxDECLARE_APP (TestApp)
 
int main (int argc, char **argv)
 

Detailed Description

Regression tests for GH #898: an identifier split by an escaped newline ("\<newline>") used to be tokenized (and therefore syntax-highlighted) as two unrelated halves – the first not even classified at all (it fell through the function/variable/operator/keyword lookups entirely), the second starting over as if it were a brand new, independent identifier.

Confirmed against a real Maxima that an escaped newline contributes nothing to the resolved symbol name at all (fo<newline>obar resolves to the plain identifier foobar), unlike an ordinary escaped character (a\,b resolves to the symbol a,b – the backslash drops but the escaped character stays part of the name). The fix keeps collecting one logical name across any number of escaped newlines for classification, while still emitting a newline as its own isolated token when rendering (the editor's line splitting depends on that – see "Tab Characters in EditorCell" in AGENTS.md).