21 lines
810 B
Elixir
21 lines
810 B
Elixir
defmodule SnmpKit.SnmpLib.MIB.ParserTest do
|
|
use ExUnit.Case, async: true
|
|
|
|
alias SnmpKit.SnmpLib.MIB.Parser
|
|
|
|
@tag :yecc_required
|
|
test "parser has known bug with index 10 (newline character)" do
|
|
mib_path = Path.join(:code.priv_dir(:towerops), "mibs/ubnt/UBNT-MIB")
|
|
{:ok, content} = File.read(mib_path)
|
|
{:ok, parsed} = Parser.parse(content)
|
|
|
|
definitions = Map.get(parsed, :definitions, [])
|
|
|
|
# ubntAFLTU is defined as { ubntMIB 10 } in the MIB file
|
|
# But the parser returns sub_index: nil because 10 is the newline character
|
|
ubnt_afltu = Enum.find(definitions, &(Map.get(&1, :name) == "ubntAFLTU"))
|
|
assert ubnt_afltu
|
|
assert Map.get(ubnt_afltu, :parent) == "ubntMIB"
|
|
assert Map.get(ubnt_afltu, :sub_index) == nil, "Known parser bug: index 10 not extracted"
|
|
end
|
|
end
|