diff --git a/shf-tests.mlb b/shf-tests.mlb index dea6bd9..7419d36 100644 --- a/shf-tests.mlb +++ b/shf-tests.mlb @@ -38,4 +38,5 @@ fcore/app-update.sml test/Railroad/src/railroad.mlb test/normal-move.sml test/normal-delete.sml +test/regression.sml test/test.sml diff --git a/test/regression.sml b/test/regression.sml new file mode 100644 index 0000000..e6f9412 --- /dev/null +++ b/test/regression.sml @@ -0,0 +1,43 @@ +structure Regression = +struct + open Railroad + open Railroad.Test + + fun updateLoop (pos, str, app) = + if pos = String.size str then + app + else + let + val chr = String.sub (str, pos) + val app = AppUpdate.update (app, InputMsg.CHAR_EVENT chr) + in + updateLoop (pos + 1, str, app) + end + + fun updateAppWithChars (historyString, app) = + updateLoop (0, historyString, app) + + fun appFromText text = + let val buffer = LineGap.fromString text + in AppType.init (buffer, 0, 0) + end + + fun loadFromFile (io, acc) = + case TextIO.inputLine io of + SOME line => loadFromFile (io, acc ^ line) + | NONE => acc + + val initialText = + let + val io = TextIO.openIn "temp.txt" + val str = loadFromFile (io, "") + val () = TextIO.closeIn io + in + str + end + + val charEventTests = describe "CHAR_EVENT regressions" + [test "placeholder" (fn _ => Expect.isTrue true)] + + val tests = [charEventTests] +end diff --git a/test/test.sml b/test/test.sml index 0f52ea8..bd87bdb 100644 --- a/test/test.sml +++ b/test/test.sml @@ -1,12 +1,16 @@ -fun main () = - let - open Railroad - open Railroad.Test +structure Test = +struct + open Railroad + open Railroad.Test - val tests = NormalMove.tests @ NormalDelete.tests - val tests = concat tests - in - runWithConfig [Configuration.PrintPassed false] tests - end + fun main () = + let + val tests = + List.concat [NormalMove.tests, NormalDelete.tests, Regression.tests] + val tests = concat tests + in + runWithConfig [Configuration.PrintPassed false] tests + end +end -val () = main () +val () = Test.main ()