# HINFO record successes

[[cmd]]
name = "Running with ‘hinfo.example’ prints the correct HINFO record"
shell = "dog --colour=always ${MADNS_ARGS:-@madns.binarystar.systems:5301 --tcp} HINFO hinfo.example"
stdout = { file = "outputs/hinfo.example.ansitxt" }
stderr = { empty = true }
status = 0
tags = [ "hinfo", "madns" ]

[[cmd]]
name = "Running with ‘utf8.hinfo.example’ escapes characters in the fields"
shell = "dog --colour=always ${MADNS_ARGS:-@madns.binarystar.systems:5301 --tcp} HINFO utf8.hinfo.example"
stdout = { file = "outputs/utf8.hinfo.example.ansitxt" }
stderr = { empty = true }
status = 0
tags = [ "hinfo", "madns", "chars" ]

[[cmd]]
name = "Running with ‘bad-utf8.hinfo.example’ escapes characters in the fields and does not crash"
shell = "dog --colour=always ${MADNS_ARGS:-@madns.binarystar.systems:5301 --tcp} HINFO bad-utf8.hinfo.example"
stdout = { file = "outputs/bad-utf8.hinfo.example.ansitxt" }
stderr = { empty = true }
status = 0
tags = [ "hinfo", "madns", "chars" ]


# HINFO record successes (JSON)

[[cmd]]
name = "Running with ‘hinfo.example --json’ prints the correct HINFO record structure"
shell = "dog --colour=always ${MADNS_ARGS:-@madns.binarystar.systems:5301 --tcp} HINFO hinfo.example --json | jq"
stdout = { file = "outputs/hinfo.example.json" }
stderr = { empty = true }
status = 0
tags = [ "hinfo", "madns", "json" ]

[[cmd]]
name = "Running with ‘utf8.hinfo.example --json’ interprets the response as UTF-8"
shell = "dog --colour=always ${MADNS_ARGS:-@madns.binarystar.systems:5301 --tcp} HINFO utf8.hinfo.example --json | jq"
stdout = { file = "outputs/utf8.hinfo.example.json" }
stderr = { empty = true }
status = 0
tags = [ "hinfo", "madns", "chars", "json" ]

[[cmd]]
name = "Running with ‘bad-utf8.hinfo.example --json’ uses UTF-8 replacement characters"
shell = "dog --colour=always ${MADNS_ARGS:-@madns.binarystar.systems:5301 --tcp} HINFO bad-utf8.hinfo.example --json | jq"
stdout = { file = "outputs/bad-utf8.hinfo.example.json" }
stderr = { empty = true }
status = 0
tags = [ "hinfo", "madns", "chars", "json" ]

# HINFO record invalid packets

[[cmd]]
name = "Running with ‘empty.hinfo.invalid’ displays a protocol error"
shell = "dog --colour=always ${MADNS_ARGS:-@madns.binarystar.systems:5301 --tcp} HINFO empty.hinfo.invalid"
stdout = { empty = true }
stderr = { string = "Error [protocol]: Malformed packet: insufficient data" }
status = 1
tags = [ "hinfo", "madns" ]

[[cmd]]
name = "Running with ‘incomplete.hinfo.invalid’ displays a protocol error"
shell = "dog --colour=always ${MADNS_ARGS:-@madns.binarystar.systems:5301 --tcp} HINFO incomplete.hinfo.invalid"
stdout = { empty = true }
stderr = { string = "Error [protocol]: Malformed packet: insufficient data" }
status = 1
tags = [ "hinfo", "madns" ]