Files
Nim/tests/stdlib/tcgi.nim
Constantine Molchanov 3f3aee4078 Added cgi.readData. Add test for cgi module. (#9645)
Added cgi.readData. Add test for cgi module.
2018-11-26 10:27:13 +01:00

24 lines
644 B
Nim
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

discard """
action: run
file: tcgi.nim
output: "[Suite] Test cgi module"
"""
import unittest
import cgi, strtabs
suite "Test cgi module":
const queryString = "foo=bar&фу=бар&checked=✓&list=1,2,3&with_space=text%20with%20space"
test "test query parsing with readData":
let parsedQuery = readData(queryString)
check parsedQuery["foo"] == "bar"
check parsedQuery["фу"] == "бар"
check parsedQuery["checked"] == ""
check parsedQuery["list"] == "1,2,3"
check parsedQuery["with_space"] == "text with space"
expect KeyError:
discard parsedQuery["not_existing_key"]