Skip to content

Commit

Permalink
Add tests for url.parse.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kami committed Jun 5, 2012
1 parent 0ff19e7 commit e778ac9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test-url.lua
@@ -0,0 +1,15 @@
require('helper')

local url = require('url')

local path = '/somepath?test=bar&ponies=foo'

local parsed = url.parse(path)
print(parsed.pathname)
print(parsed.query)
assert(parsed.pathname == '/somepath')
assert(parsed.query == 'test=bar&ponies=foo')

local parsed = url.parse(path, true)
assert(parsed.pathname == '/somepath')
assert(deep_equal(parsed.query, {test = 'bar', ponies = 'foo'}))

0 comments on commit e778ac9

Please sign in to comment.