diff options
Diffstat (limited to 'forth/foreforthfourth/test-help-full.js')
-rw-r--r-- | forth/foreforthfourth/test-help-full.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/forth/foreforthfourth/test-help-full.js b/forth/foreforthfourth/test-help-full.js new file mode 100644 index 0000000..bf257ec --- /dev/null +++ b/forth/foreforthfourth/test-help-full.js @@ -0,0 +1,33 @@ +// Test to see the complete help output +const ForthInterpreter = require('./forth.js'); + +console.log('🔍 Testing Complete Help Output\n'); + +let state = ForthInterpreter.createInitialState(); + +// Run help command +console.log('Running help command...'); +state = ForthInterpreter.parseAndExecute(state, 'help'); + +console.log('\n=== COMPLETE HELP OUTPUT ==='); +state.output.forEach((line, i) => { + console.log(`${i + 1}: ${line}`); +}); + +console.log('\n=== ANALYSIS ==='); +console.log('Total output lines:', state.output.length); + +// Count built-in words in help output +const helpLines = state.output.filter(line => line.includes(' - ')); +console.log('Lines with word documentation:', helpLines.length); + +// Check if specific words are present +const expectedWords = ['dup', 'swap', 'drop', '+', '-', '*', '/', 'mod', 'if', 'then', 'begin', 'until']; +expectedWords.forEach(word => { + const found = helpLines.some(line => line.startsWith(word)); + console.log(`${word}: ${found ? '✅' : '❌'}`); +}); + +// Show first few documented words +console.log('\nFirst 10 documented words:'); +helpLines.slice(0, 10).forEach(line => console.log(line)); |