883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
26 lines
2.0 KiB
Lua
26 lines
2.0 KiB
Lua
local root=arg[1];local frames={};local sent={};local clock=1
|
|
getglobal=function(n)return _G[n]end;setglobal=function(n,v)_G[n]=v end
|
|
if not table.getn then table.getn=function(t)return #t end end
|
|
GetTime=function()return clock end
|
|
CreateFrame=function()local f={events={}};table.insert(frames,f);function f:RegisterEvent(e)self.events[e]=true end;function f:SetScript(e,h)self.handler=h end;function f:UnregisterAllEvents()self.events={}end;return f end
|
|
SlashCmdList={};DEFAULT_CHAT_FRAME={AddMessage=function()end}
|
|
local chat=function(a,b,c,d)table.insert(sent,{a,b,c,d});return 'chat-return',42 end
|
|
local add=function(a)table.insert(sent,{'add',a});return 'friend-return',43 end
|
|
SendChatMessage=chat;AddFriend=add
|
|
LoggingChat=function(v)return v end;GetNumFriends=function()return 1 end
|
|
GetFriendInfo=function(i)return 'friend',60,'Warrior','Silithus',true,''end
|
|
pfUI_cache={preserved=true}
|
|
dofile(root..'/client_addons/OctoSocialCapture/Observer.lua')
|
|
assert(not WoWHybridSocialObserver and #sent==0)
|
|
event='PLAYER_LOGIN';frames[1].handler();local O=WoWHybridSocialObserver;local C=O.capture
|
|
assert(pfUI_cache.preserved and #sent==0 and C.chatLogging==1)
|
|
local a,b=SendChatMessage('hello','WHISPER',nil,'target');assert(a=='chat-return'and b==42 and sent[1][4]=='target')
|
|
a,b=AddFriend('friend');assert(a=='friend-return'and b==43 and sent[2][2]=='friend')
|
|
local n=#C.rows;event='FRIENDLIST_UPDATE';arg1=nil;frames[2].handler();assert(#C.rows==n+3)
|
|
assert(C.rows[#C.rows].args[1]=='friend'and C.rows[#C.rows].args[5]==true)
|
|
O.maxRows=#C.rows;SendChatMessage('still sent','WHISPER',nil,'target');assert(C.dropped==1 and #sent==3)
|
|
SlashCmdList.WOWHYBRIDSOCIALCAPTURE('stop');assert(SendChatMessage==chat and AddFriend==add)
|
|
assert(not O.active and next(frames[2].events)==nil)
|
|
SendChatMessage('after stop','WHISPER',nil,'target');assert(#sent==4 and C.dropped==1)
|
|
print('Social observer preserves API arguments/returns, records matching events/state, bounds output, sends no gameplay actions of its own, and detaches.')
|