reforged-test
This page is generated from packages/reforged-test/CHANGELOG.md by docs:collect. Edit the source, not this page.
1.0.0-alpha.4
Minor Changes
- #302
c055b24Thanks @wyller! -Unit.skillPoints = nsets the hero's unspent skill points ton, where it addednbefore;Unit.modifySkillPointsstill adds.Unit.addItemByIdreturns the item it created when the inventory has no room, the item then lying at the unit's feet, where it threw before: it callsCreateItemandUnitAddIteminstead ofUnitAddItemById, which returns nothing for that item, and still throws for a removed unit. The test harness stubsGetUnitX,GetUnitY,UnitAddItem,UnitModifySkillPointsandGetHeroSkillPoints.
1.0.0-alpha.3
Minor Changes
- #275
c48d56aThanks @wyller! - The Trigger remove members take what the add members were given:trigger.removeAction(fn)removes the actionstrigger.addAction(fn)added, andtrigger.removeCondition(fnOrBoolexpr)the conditionsaddConditionadded, destroying theConditionthe Trigger made for a function (never aboolexpryou passed).removeActions(),removeConditions()anddestroy()also destroy thoseConditions, which used to leak. Every function condition now gets aConditionof its own, around a closure the Trigger makes with Dev mode on or off, so two adds of one function never share a handle, and aCondition(fn)of yours is never destroyed. A condition removed from inside its own evaluation has itsConditiondestroyed when that evaluation returns. A rawtriggeractionortriggerconditionstill goes straight to the Native, and every remove member now returns the Trigger. TheBoolexprInputtype the condition members name is exported. The test harness stubsDestroyCondition; itsConditionandFilterreturn the same handle for the same function until it is destroyed, as JASS caches one per code; and a stub handle'stostringnow begins with its kind and a colon, as in the game.
1.0.0-alpha.2
Minor Changes
- #267
6aee802Thanks @phmilk! - Stubs forBlzGroupAddGroupFastandBlzGroupRemoveGroupFast, which change their second group as the game does, so a test can callGroup.addGroupFastandGroup.removeGroupFaston the harness.
1.0.0-alpha.1
Minor Changes
-
#208
f48fefdThanks @phmilk! - Stubs and constants for the 3.0.0 systems, so a test can call the equipment, destructable, colour, input, camera and pathing members on the harness and see the calls they made.- Equipment converters (
items.lua):ConvertEquipmentType,ConvertItemTagandConvertLoadoutSlotare recorded and return one cached sentinel per integer, as in the game. The named constantsEQUIPMENT_TYPE_*(0 to 9),ITEMTAG_TYPE_*(0 to 8) andEQUIPMENT_LOADOUT_SLOT_*(0 to 8,RINGALT5 included) are those sentinels, soConvertEquipmentType(1)isEQUIPMENT_TYPE_HEAD. An integer with no named constant gets a distinct sentinel rendered asConvertEquipmentType(42), which is how a test builds an unknown value. The README explains the sentinel rule. - Destructable constructors (
destructables.lua): all 32 creation Natives of the Patch, the 28 new ones being the dead, Z, pitch-roll, with-skin and with-colour families and their combinations. Each records one argument per parameter in the Native's order, and any extra argument after them, and returns a new destructable. - Constant families, opaque values rendered by name:
PLAYER_COLOR_*(PLAYER_COLOR_BLACKincluded) andRACE_PREF_*(RACE_PREF_FORSAKENincluded) inplayers.lua;ITEM_TYPE_*(ITEM_TYPE_EQUIPMENTincluded,ITEM_TYPE_TOMEbeingITEM_TYPE_POWERUP) initems.lua;CAMERA_FIELD_*incameras.lua;MOUSE_BUTTON_TYPE_*intriggers.lua;PATHING_TYPE_*interrain.lua, a new family. The baseline gains__stub_constants(kind, names), which defines a family of constants in one call.
- Equipment converters (
Patch Changes
- #209
7aa0edeThanks @phmilk! - The README's "For AI agents" line links the documentation of this version as Markdown for a language model:llms.txt, one link per page, andllms-full.txt, every page in one file. A prerelease links the working tree's docs,https://phmilk.github.io/reforged-ts/docs/next/llms.txt; a stable release links the docs version of its library minor,/docs/<major.minor>/llms.txt.
1.0.0-alpha.0
Major Changes
- #159
05eda1aThanks @phmilk! - First release under this name, for Warcraft III 3.0.0 and later.reforged-tsis the fork of w3ts 3.0.2;reforged-types,reforged-testandeslint-plugin-reforgedare new packages.
Minor Changes
-
#145
73ca570Thanks @wyller! - Test controls for the runtime Guards, so a test can run code as another client, read what reached the log and the screen, enter the globals Init stage, re-enter a damage handler, and check which function a Native was handed.players.lua:__stub_set_local_player(slot)makes another slot the local player (slot 0 until then) and returns the slot it replaced;__stub_local_player()returns its handle without a call-log line.- Output capture. The baseline's
printwrites to a capture instead of the terminal;__stub_printed()returns the lines.display.lua, a new family:DisplayTextToPlayer,DisplayTimedTextToPlayerandDisplayTimedTextFromPlayerare recorded and keep what they showed to which player, returned by__stub_displayed();ClearTextMessagesis recorded. - The globals Init stage.
__stub_init_globals()calls the globalInitGlobals, defining it first by a plain assignment when nothing did, so the library's wrapper runs the stage. - Nested damage dispatch.
UnitDamageTargetis recorded, returns true and dispatches the damage at once through__stub_dispatch_damage(damage), which fires the triggers registered for a damaging and then a damaged event on the target (its unit, or its owner through a player-unit registration whose filter accepts it, withGetFilterUnit, now stubbed, answering the target) with the damage response Natives in the firing context. An action that deals damage dispatches again inside its own firing; past 32 nested dispatches the harness throws, instead of the client crashing as the game does. - Call arguments.
__stub_args(name)returns the arguments of every recorded call of a Native by identity, so a test sees which functionTimerStart,TriggerAddAction,ConditionorFilterreceived.
-
#100
f3043a4Thanks @phmilk! - Slot-state and sync-event stubs, so a test can run a Map project's host scan and sync registration on the harness.players.luagainsGetPlayerSlotStateandGetPlayerController: slots 0 and 1 are playing users, every other slot is empty with no controller. This is state the stubs hold, named in the README, not a game rule.- The baseline gains the constants they answer with,
PLAYER_SLOT_STATE_EMPTY,PLAYER_SLOT_STATE_PLAYING,PLAYER_SLOT_STATE_LEFT,MAP_CONTROL_USER,MAP_CONTROL_COMPUTER,MAP_CONTROL_RESCUABLE,MAP_CONTROL_NEUTRAL,MAP_CONTROL_CREEPandMAP_CONTROL_NONE, defined before any library module loads as opaque values compared by identity.__stub_constant(kind, name)builds one without taking a handle id, and__stub_recordrenders a constant by its name. triggers.luagainsBlzTriggerRegisterPlayerSyncEvent, recorded with the trigger, the player, the prefix and the flag and returning an event handle. The trigger keeps nothing of it beyond the call-log line; sync events never fire on the harness.
-
#82
f62784dThanks @phmilk! - Stubs for every Native family the reforged-ts Wrappers create or look up through.- New stub families:
cameras,destructables,dialogs,effects,fogmodifiers,forces,frames,gamecaches,groups,images,items,leaderboards,locations,multiboards,quests,rects,regions,sounds,texttags,timerdialogs,ubersplats,weathereffectsandwidgets, loaded with the shipped set;units.luagainsBlzCreateUnitWithSkin,GetUnitLoc, the rally getters and the inventory Natives. The README's table lists each file's Natives. __stub_frame_not_found()returns the frame the game hands back when it finds none (handle id 0), for a test to return from a Native it overrides for one call.- The stub authoring rule now reads: a stub keeps only the state its Natives were given and hands it back through the Natives that read it; it never simulates game rules.
- New stub families:
-
#132
af9eadeThanks @phmilk! - Sync send and delivery, a settable clock and local player, the Preload family and ability icon stubs, so a test can watch what the sync, host and file Systems would do in the game: which packets a client sent, what the sync event delivers back, how long a client sat in the lobby, and what a file write was given.sync.lua, a new family:BlzSendSyncDatais recorded, keeps the packet with its prefix, its data and the local player that sent it, and returns true (a test that needs a network failure overrides it).__stub_sync_packets()returns the packets sent so far.triggers.lua:BlzTriggerRegisterPlayerSyncEventalso remembers its trigger, player and prefix, a deliberate exception to the rule that a registration keeps nothing beyond its call-log line, because a delivery must find the triggers the game would fire.__stub_deliver_sync(packet, options?)fires every enabled trigger registered for the packet's prefix and sender, withBlzGetTriggerSyncPrefix,BlzGetTriggerSyncData,GetTriggerPlayerandGetTriggeringTriggeranswering from the firing context;{ cString = true }cuts the data at its first zero byte, as the game cuts a C string. A packet the test builds simulates one from another library.- The baseline:
os.clockanswers what__stub_set_clock(seconds)set, 0.0 until then, and keeps it until the next set. players.lua:__stub_set_local_player(slot)makes another slot the local player (slot 0 until then), and__stub_local_player()returns its handle without a call-log line.preloads.lua, a new family:PreloadGenClear,PreloadGenStart,Preload,PreloadGenEndandPreloaderare recorded with their arguments;__stub_preload_file(filename)returns the strings the last write of that file was given.Preloaderonly records; a test that emulates a read overrides it.abilities.lua, a new family:BlzGetAbilityIconandBlzSetAbilityIconkeep an icon per ability id, with the game's placeholder icon for an id never set.
-
#111
2d69302Thanks @phmilk! - Trigger registration recording, conditions, firing with a context, timer expiry and trackable stubs, so a test can observe what the game would observe of event code: which registration Native a trigger called with which arguments, which conditions and actions it was handed, and what a handler read when the trigger fired.triggers.luagains everyTriggerRegister*Native of Patch 3.0.0.24268 (26, theBlzones included), each recorded with the trigger and one argument per parameter (an omitted filter asnil) and returning a neweventhandle; the trigger keeps nothing of a registration.ConditionandFilterare recorded and each call returns a newconditionfuncorfilterfunchandle that remembers its function.TriggerAddConditionstores the condition and returns atriggerconditionhandle;TriggerRemoveAction,TriggerRemoveCondition,TriggerClearActionsandTriggerClearConditionsremove what they name;TriggerEvaluateruns the conditions and returns their conjunction;TriggerExecuteandTriggerExecuteWaitrun the actions.EnableTrigger,DisableTrigger,IsTriggerEnabled,TriggerWaitOnSleeps,IsTriggerWaitOnSleeps,GetTriggerEvalCount,GetTriggerExecCount(0),ResetTriggerandDestroyTriggerare recorded.- Firing with a context.
__stub_fire_trigger(trigger, context?)takes an optional table keyed by response Native name: for the length of the firing every response Native answers with the context's value for its name (nil when absent); every condition runs first, in added order, and the actions run only if every condition returned true. It returns whether the actions ran. Outside a firing every response Native answers nil. A disabled trigger does not fire, and firing a destroyed one is an error. - The response Natives every shipped event descriptor reads, one recorded stub each (units, damage, spells, orders, items, players, dialogs, frames, regions, the triggering trigger and event), and the event constants they take and answer with (
EVENT_PLAYER_UNIT_DEATH,EVENT_PLAYER_MOUSE_DOWN,FRAMEEVENT_CONTROL_CLICK,ATTACK_TYPE_HERO,OSKEY_Aand the rest of their kinds), rendered by name. timers.luagainsGetExpiredTimer, which answers the fired timer inside the handler__stub_fire_timerruns and nil outside it, andPauseTimer,ResumeTimer,TimerGetElapsedandTimerGetRemaining(0.0: no time passes).DestroyTimermarks the timer, and firing a destroyed timer is an error.units.luagainsSetHeroLevelandGetHeroLevel: a unit keeps the level it was given and hands it back, 0 before any, for the hero-level event's payload.trackables.lua, a new family:CreateTrackable, returning atrackablehandle, andGetTriggeringTrackable, answering from the firing context.- The baseline gains
__stub_response(name), which defines a response Native answering from the firing context, and__stub_with_context(context, body), which runsbodywith a firing context and hands the previous one back afterwards, also on error.