Skip to main content

reforged-test

Generated page

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 c055b24 Thanks @wyller! - Unit.skillPoints = n sets the hero's unspent skill points to n, where it added n before; Unit.modifySkillPoints still adds. Unit.addItemById returns the item it created when the inventory has no room, the item then lying at the unit's feet, where it threw before: it calls CreateItem and UnitAddItem instead of UnitAddItemById, which returns nothing for that item, and still throws for a removed unit. The test harness stubs GetUnitX, GetUnitY, UnitAddItem, UnitModifySkillPoints and GetHeroSkillPoints.

1.0.0-alpha.3​

Minor Changes​

  • #275 c48d56a Thanks @wyller! - The Trigger remove members take what the add members were given: trigger.removeAction(fn) removes the actions trigger.addAction(fn) added, and trigger.removeCondition(fnOrBoolexpr) the conditions addCondition added, destroying the Condition the Trigger made for a function (never a boolexpr you passed). removeActions(), removeConditions() and destroy() also destroy those Conditions, which used to leak. Every function condition now gets a Condition of 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 a Condition(fn) of yours is never destroyed. A condition removed from inside its own evaluation has its Condition destroyed when that evaluation returns. A raw triggeraction or triggercondition still goes straight to the Native, and every remove member now returns the Trigger. The BoolexprInput type the condition members name is exported. The test harness stubs DestroyCondition; its Condition and Filter return the same handle for the same function until it is destroyed, as JASS caches one per code; and a stub handle's tostring now begins with its kind and a colon, as in the game.

1.0.0-alpha.2​

Minor Changes​

  • #267 6aee802 Thanks @phmilk! - Stubs for BlzGroupAddGroupFast and BlzGroupRemoveGroupFast, which change their second group as the game does, so a test can call Group.addGroupFast and Group.removeGroupFast on the harness.

1.0.0-alpha.1​

Minor Changes​

  • #208 f48fefd Thanks @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, ConvertItemTag and ConvertLoadoutSlot are recorded and return one cached sentinel per integer, as in the game. The named constants EQUIPMENT_TYPE_* (0 to 9), ITEMTAG_TYPE_* (0 to 8) and EQUIPMENT_LOADOUT_SLOT_* (0 to 8, RINGALT 5 included) are those sentinels, so ConvertEquipmentType(1) is EQUIPMENT_TYPE_HEAD. An integer with no named constant gets a distinct sentinel rendered as ConvertEquipmentType(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_BLACK included) and RACE_PREF_* (RACE_PREF_FORSAKEN included) in players.lua; ITEM_TYPE_* (ITEM_TYPE_EQUIPMENT included, ITEM_TYPE_TOME being ITEM_TYPE_POWERUP) in items.lua; CAMERA_FIELD_* in cameras.lua; MOUSE_BUTTON_TYPE_* in triggers.lua; PATHING_TYPE_* in terrain.lua, a new family. The baseline gains __stub_constants(kind, names), which defines a family of constants in one call.

Patch Changes​

  • #209 7aa0ede Thanks @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, and llms-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 05eda1a Thanks @phmilk! - First release under this name, for Warcraft III 3.0.0 and later. reforged-ts is the fork of w3ts 3.0.2; reforged-types, reforged-test and eslint-plugin-reforged are new packages.

Minor Changes​

  • #145 73ca570 Thanks @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 print writes to a capture instead of the terminal; __stub_printed() returns the lines. display.lua, a new family: DisplayTextToPlayer, DisplayTimedTextToPlayer and DisplayTimedTextFromPlayer are recorded and keep what they showed to which player, returned by __stub_displayed(); ClearTextMessages is recorded.
    • The globals Init stage. __stub_init_globals() calls the global InitGlobals, defining it first by a plain assignment when nothing did, so the library's wrapper runs the stage.
    • Nested damage dispatch. UnitDamageTarget is 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, with GetFilterUnit, 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 function TimerStart, TriggerAddAction, Condition or Filter received.
  • #100 f3043a4 Thanks @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.lua gains GetPlayerSlotState and GetPlayerController: 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_CREEP and MAP_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_record renders a constant by its name.
    • triggers.lua gains BlzTriggerRegisterPlayerSyncEvent, 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 f62784d Thanks @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, weathereffects and widgets, loaded with the shipped set; units.lua gains BlzCreateUnitWithSkin, 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.
  • #132 af9eade Thanks @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: BlzSendSyncData is 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: BlzTriggerRegisterPlayerSyncEvent also 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, with BlzGetTriggerSyncPrefix, BlzGetTriggerSyncData, GetTriggerPlayer and GetTriggeringTrigger answering 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.clock answers 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, PreloadGenEnd and Preloader are recorded with their arguments; __stub_preload_file(filename) returns the strings the last write of that file was given. Preloader only records; a test that emulates a read overrides it.
    • abilities.lua, a new family: BlzGetAbilityIcon and BlzSetAbilityIcon keep an icon per ability id, with the game's placeholder icon for an id never set.
  • #111 2d69302 Thanks @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.lua gains every TriggerRegister* Native of Patch 3.0.0.24268 (26, the Blz ones included), each recorded with the trigger and one argument per parameter (an omitted filter as nil) and returning a new event handle; the trigger keeps nothing of a registration. Condition and Filter are recorded and each call returns a new conditionfunc or filterfunc handle that remembers its function. TriggerAddCondition stores the condition and returns a triggercondition handle; TriggerRemoveAction, TriggerRemoveCondition, TriggerClearActions and TriggerClearConditions remove what they name; TriggerEvaluate runs the conditions and returns their conjunction; TriggerExecute and TriggerExecuteWait run the actions. EnableTrigger, DisableTrigger, IsTriggerEnabled, TriggerWaitOnSleeps, IsTriggerWaitOnSleeps, GetTriggerEvalCount, GetTriggerExecCount (0), ResetTrigger and DestroyTrigger are 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_A and the rest of their kinds), rendered by name.
    • timers.lua gains GetExpiredTimer, which answers the fired timer inside the handler __stub_fire_timer runs and nil outside it, and PauseTimer, ResumeTimer, TimerGetElapsed and TimerGetRemaining (0.0: no time passes). DestroyTimer marks the timer, and firing a destroyed timer is an error.
    • units.lua gains SetHeroLevel and GetHeroLevel: 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 a trackable handle, and GetTriggeringTrackable, 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 runs body with a firing context and hands the previous one back afterwards, also on error.