Log Surgeon
Test & API docs
Loading...
Searching...
No Matches
Buffer parser using variables containing

Tests for BufferParser using a schema where variables are defined with custom delimiters. More...

Functions

void multi_line_with_delimited_vars ()
 Tests BufferParser with delimited variables using a custom schema.

Detailed Description

Tests for BufferParser using a schema where variables are defined with custom delimiters.

delimiters.

This group contains tests that verify tokenization using:

  • Custom delimiters (\n\r\[:,)
  • Variables that require delimiters to separate them properly in the input.

These tests ensure the parser correctly handles and matches variables bounded by specified delimiters.

Function Documentation

◆ multi_line_with_delimited_vars()

void multi_line_with_delimited_vars ( )

Tests BufferParser with delimited variables using a custom schema.

This test verifies that the BufferParser correctly handles variables separated by custom delimiters specified in the schema. The schema defines:

  • Delimiters as newline, carriage return, openning bracket, colon, and comma (\n\r\[:,)
  • Variable function with regex function:[A-Za-z]+::[A-Za-z]+1
  • Variable path with regex path:[a-zA-Z0-9_/\.\-]+/[a-zA-Z0-9_/\.\-]+

The test inputs validate tokenization of strings containing these variables, ensuring variables are correctly identified and delimited tokens are separated.

Schema Definition

delimiters: \n\r\[:,
function: [A-Za-z]+::[A-Za-z]+1
path: [a-zA-Z0-9_/\.\-]+/[a-zA-Z0-9_/\.\-]+

Test Inputs

"[WARNING] A:2 [folder/file.cc:150] insert node:folder/file-op7, id:7 and folder/file-op8, id:8\n
Perform App::Action App::Action1 ::App::Action::Action1 on word::my/path/to/file.txt"

Expected Logtype

"[WARNING] A:2 [<path>:150] insert node:<path>, id:7 and <path>, id:8<newLine>"
"Perform App::Action <function> ::App::<function> on word::<path>"

Expected Tokenization

"[WARNING]" -> uncaught string
" A" -> uncaught string
":2" -> uncaught string
" " -> uncaught string
"[folder/file.cc" -> "path"
":150]" -> uncaught string
" insert" -> uncaught string
" node" -> uncaught string
:folder/file-op7 -> "path"
"," -> uncaught string
" id" -> uncaught string
":7" -> uncaught string
" and" -> uncaught string
" folder/file-op8" -> "path"
"," -> uncaught string
" id" -> uncaught string
":8" -> uncaught string
"\n" -> "newLine"
"Perform" -> uncaught string
" App" -> uncaught string
":" -> uncaught string
":Action" -> uncaught string
" App::Action1" -> "function"
" " -> uncaught string
":" -> uncaught string
":App" -> uncaught string
":" -> uncaught string
":Action::Action1" -> "function"
" on" -> uncaught string
" word" -> uncaught string
":" -> uncaught string
":my/path/to/file.txt" -> "path"