Failing test case for #11

This commit is contained in:
2024-02-14 21:45:48 -07:00
parent 8f54d3992a
commit 29ff2c2d2f
2 changed files with 102 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
package test.cases;
import utest.Test;
import utest.Assert;
import kiss.Prelude;
import kiss.List;
import kiss.Stream;
import haxe.ds.Option;
import kiss.Kiss;
#if js
import js.lib.Promise;
#end
using StringTools;
@:build(kiss.Kiss.buildExpectingError(kiss.EType.EUnmatchedBracket("(")))
class UnclosedMacroTestCase extends Test {
function testSplitByAll() {
Assert.pass();
}
function testExpectedError() {
_testExpectedError();
}
}

View File

@@ -0,0 +1,77 @@
(defMacro addSkips [flxMovieClass]
`{
(method &override :Void prepareForSkip []
(print "prepareForSkip override called")
// TODO these things could/should all be in HollywooDSL:
(kiss_tools.TimerWithPause.stopAll)
(flxDirector.pause)
(.clear (director.shortcutHandler))
(flxDirector.cleanup)
(cond
(~didLoading
(set skipMovie (new ,flxMovieClass flxDirector))
(skipMovie.scavengeObjects this)
(doCleanup))
(true
(set skipMovie ~this)))
(preload
(unless (FlxG.inputs.list.contains flxDirector.actionManager)
(FlxG.inputs.add flxDirector.actionManager))
(set onCommitLabel ->:Void label {
(FlxDirector.lastSceneForMovie this label)
}))
(cleanup
(when skipMovie?.running
(callPrivate skipMovie "doCleanup")))
(cleanup
(set tweens [])
(set flxDirector.nextCC null)
(loopingSoundPlays.clear)
(destroyAndClear actors)
(destroyAndClear props)
(destroyAndClear sets)
(destroyAndClear sounds)
(destroyAndClear voiceTracks)
(destroyAndClear songs)
(when (flixel.FlxG.cameras.list.contains uiCamera)
(flixel.FlxG.cameras.remove uiCamera true))
(when (flixel.FlxG.cameras.list.contains screenCamera)
(flixel.FlxG.cameras.remove screenCamera true))
// I hope this disposes of references to actors, props, sets, etc.:
(scenes.clear)
(propScales.m.clear)
(propsInScene.clear)
(overlaidPropsInScenes.clear)
(doFor m tweenedPositionsOfSpritesInScenes
(doFor p m
(p.put))
(m.clear))
(tweenedPositionsOfSpritesInScenes.clear)
(doFor =>key lightSourceList lightSources
(whileLet [lightSource (lightSourceList.elements.pop)]
(lightSource.destroy)))
(#when cpp
(cpp.vm.Gc.run true)
(cpp.vm.Gc.compact)))
(#when debug
(preload
(.registerItem (director.shortcutHandler) "[n]ext label"
->cc {
(prepareForSkip)
(runFromNextLabel skipMovie)
})
(.registerItem (director.shortcutHandler) "skip to [l]abel"
->cc
(flxDirector.sceneSelection ->:Void {}))))
})