package.path = "./?.lua;./?/init.lua;" .. package.path local T = require("tests.harness") love = love or require("tests.love_stub") local OnlinePanel = require("src.import.OnlinePanel") local SyncState = require("src.sync.SyncState") local Client = require("src.online.Client") -- ------------------------------------------------------------- names T.eq(OnlinePanel.sanitizeName("RED"), "RED", "a plain name survives") T.eq(OnlinePanel.sanitizeName('RD&"x\''), "REDx", "the relay's five banned characters are dropped") T.eq(OnlinePanel.sanitizeName(" RED "), "RED", "outer space is trimmed") T.eq(#OnlinePanel.sanitizeName(("A"):rep(40)), OnlinePanel.NAME_MAX, "a long name is capped at 16") T.check(OnlinePanel.nameValid("RED#417"), "RED#417 is a valid display name") T.check(not OnlinePanel.nameValid("AB"), "two characters is too short") T.check(not OnlinePanel.nameValid(("A"):rep(17)), "seventeen is too long") T.check(not OnlinePanel.nameValid("RE