tokenizer_test.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package raku
  2. import (
  3. // "strings"
  4. "testing"
  5. "os"
  6. "gitlab.com/beoran/woe/monolog"
  7. // "gitlab.com/beoran/woe/tree"
  8. )
  9. func HelperTryTokenizing(input string, test *testing.T) {
  10. test.Logf("Tokenizing started:")
  11. output := Tokenize(input)
  12. for _, token := range output {
  13. test.Logf("Token %s", token.String())
  14. }
  15. }
  16. func TestTokenizing1(test *testing.T) {
  17. const input = `
  18. say "hello \"world\\"
  19. define open a door do
  20. set (door's open) true
  21. let door 's open be true
  22. end
  23. def increment variable by value do
  24. ( variable = ( variable + value ) )
  25. end
  26. "
  27. `
  28. HelperTryTokenizing(input, test)
  29. test.Log("Hi test!")
  30. }
  31. func TestTokenizing2(test *testing.T) {
  32. const input = `say`
  33. HelperTryTokenizing(input, test)
  34. test.Log("Hi test!")
  35. }
  36. func TestTokenizing3(test *testing.T) {
  37. const input = `$sym`
  38. HelperTryTokenizing(input, test)
  39. test.Log("Hi test!")
  40. }
  41. func TestMain(m *testing.M) {
  42. monolog.Setup("raku_test.log", true, false)
  43. // monolog.EnableLevel("DEBUG")
  44. retCode := m.Run()
  45. monolog.Close()
  46. os.Exit(retCode)
  47. }