diff --git a/src/main/resources/data/computercraft/lua/rom/programs/motd.lua b/src/main/resources/data/computercraft/lua/rom/programs/motd.lua index 57ab7b916..5a2e78b83 100644 --- a/src/main/resources/data/computercraft/lua/rom/programs/motd.lua +++ b/src/main/resources/data/computercraft/lua/rom/programs/motd.lua @@ -5,6 +5,8 @@ elseif date.month == 12 and date.day == 24 then print("Merry X-mas!") elseif date.month == 10 and date.day == 31 then print("OOoooOOOoooo! Spooky!") +elseif date.month == 4 and date.day == 28 then + print("Ed Balls") else local tMotd = {} diff --git a/src/test/resources/test-rom/spec/programs/motd_spec.lua b/src/test/resources/test-rom/spec/programs/motd_spec.lua index d426fb6e7..47fcfccd3 100644 --- a/src/test/resources/test-rom/spec/programs/motd_spec.lua +++ b/src/test/resources/test-rom/spec/programs/motd_spec.lua @@ -1,8 +1,8 @@ local capture = require "test_helpers".capture_program describe("The motd program", function() - local function setup_date(month, day) - stub(os, "date", function() return { month = month, day = day } end) + local function setup_date(day, month) + stub(os, "date", function() return { day = day, month = month } end) end it("displays MOTD", function() @@ -16,20 +16,26 @@ describe("The motd program", function() :matches { ok = true, output = "Hello World!\n", error = "" } end) - it("displays date-specific MOTD (1/1)", function() + it("displays date-specific MOTD (1 Jan)", function() setup_date(1, 1) expect(capture(stub, "motd")) :matches { ok = true, output = "Happy new year!\n", error = "" } end) - it("displays date-specific MOTD (10/31)", function() - setup_date(10, 31) + it("displays date-specific MOTD (28 Apr)", function() + setup_date(28, 4) + expect(capture(stub, "motd")) + :matches { ok = true, output = "Ed Balls\n", error = "" } + end) + + it("displays date-specific MOTD (31 Oct)", function() + setup_date(31, 10) expect(capture(stub, "motd")) :matches { ok = true, output = "OOoooOOOoooo! Spooky!\n", error = "" } end) - it("displays date-specific MOTD (12/24)", function() - setup_date(12, 24) + it("displays date-specific MOTD (24 Dec)", function() + setup_date(24, 12) expect(capture(stub, "motd")) :matches { ok = true, output = "Merry X-mas!\n", error = "" } end)