diff --git a/bidi.lua b/bidi.lua index 032b019..1c069ce 100644 --- a/bidi.lua +++ b/bidi.lua @@ -207,7 +207,7 @@ assert( "EN" == test_output[3].bidi_class ) -bidi.W3 = function(run) +local W3 = function(run) -- Change al ALs to R. for i = 1, #run do if "AL" == run[i].bidi_class then @@ -217,6 +217,19 @@ bidi.W3 = function(run) return run end +-- Test W3: AL AL AL → R R R +local test_input = { + { ["bidi_class"] = "AL" }, + { ["bidi_class"] = "AL" }, + { ["bidi_class"] = "AL" }, +} +local test_output = W3(test_input) +assert( + "R" == test_output[1].bidi_class and + "R" == test_output[2].bidi_class and + "R" == test_output[3].bidi_class +) + bidi.W4 = function(run) for i = 1, #run do if "ES" == run[i].bidi_class then @@ -323,7 +336,7 @@ end bidi.resolve_weak_types = function(run, sos) run = bidi.W1(run, sos) run = W2(run, sos) - run = bidi.W3(run) + run = W3(run) run = bidi.W4(run) run = bidi.W5(run) run = bidi.W6(run)