raku_test.go 565 B

12345678910111213141516171819202122232425262728293031323334
  1. // raku_test.go
  2. package raku
  3. import (
  4. "strings"
  5. "testing"
  6. )
  7. func HelperTryLexing(me *Lexer, test *testing.T) {
  8. go me.Start()
  9. test.Logf("Lexing started:")
  10. test.Logf("Lexer buffer: %v", me.buffer)
  11. for token := range me.Output {
  12. test.Logf("Token %s", token)
  13. }
  14. }
  15. func TestLexing(test *testing.T) {
  16. const input = `
  17. say "hello \"world\\"
  18. to open a door do
  19. set door's open to true
  20. end
  21. to increment variable by value do
  22. variable = variable + value
  23. end
  24. `
  25. lexer := OpenLexer(strings.NewReader(input))
  26. HelperTryLexing(lexer, test)
  27. test.Log("Hi test!")
  28. }