mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 11:37:35 +00:00
32 lines
1.3 KiB
Lua
32 lines
1.3 KiB
Lua
-- Copyright 2022 Justine Alexandra Roberts Tunney
|
|
--
|
|
-- Permission to use, copy, modify, and/or distribute this software for
|
|
-- any purpose with or without fee is hereby granted, provided that the
|
|
-- above copyright notice and this permission notice appear in all copies.
|
|
--
|
|
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
|
-- WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
|
-- WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
|
-- AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
|
-- DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
|
-- PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
-- TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
-- PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
assert(unix.pledge("stdio"))
|
|
|
|
-- test redbean lua language extensions
|
|
assert(0b100 == 4)
|
|
assert(0200 == 128)
|
|
assert("\e" == "\x1b")
|
|
assert("hi" * 3 == "hihihi")
|
|
assert("hello %d" % {123} == "hello 123")
|
|
|
|
-- test ProgramContentType
|
|
assert(ProgramContentType("txt") == "text/plain")
|
|
assert(ProgramContentType("htm") == "text/html")
|
|
assert(ProgramContentType("abc.htm") == "text/html")
|
|
assert(ProgramContentType("1") == nil)
|
|
ProgramContentType("1", "text/x-foo")
|
|
assert(ProgramContentType("1"), "text/x-foo")
|
|
assert(ProgramContentType("file.1"), "text/x-foo")
|