File: test-loading.lua

package info (click to toggle)
oocairo 1.4-1.2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 712 kB
  • sloc: ansic: 3,352; makefile: 59; sh: 15
file content (25 lines) | stat: -rw-r--r-- 747 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
-- This test program ensures that the modules are loaded without polluting
-- the global namespace.  It can't be part of the main test suite because
-- by the time the code runs the modules will already have been loaded.

require "test-setup"

local orig_globals = {}
for key in pairs(_G) do orig_globals[key] = true end

local Cairo = require "oocairo"

for key in pairs(_G) do
    if not orig_globals[key] then
        error("namespace pollution loading module:" ..
              " global '" .. key .. "' created by lib")
    end
end
for key in pairs(orig_globals) do
    if _G[key] == nil then
        error("namespace pollution loading module:" ..
              " global '" .. key .. "' deleted by lib")
    end
end

-- vi:ts=4 sw=4 expandtab