I’ve really been enjoying using exercise to learn Swift over the last few weeks. I’m working my way through the syllabus and am stuck at the Windowing System exercise.
Obviously, I’m new, so I’m probably doing something wrong. One of the tasks directs you to create an instance of Window and call some class methods on the instance to modify it. I am able to create the instance. However, every attempt to modify it results in an error:
/mnt/exercism-iteration/Sources/WindowingSystem/WindowingSystem.swift:82:1: error: expressions are not allowed at the top level mainWindow.update(title: "Main Window") ^ /mnt/exercism-iteration/Sources/WindowingSystem/WindowingSystem.swift:82:1: error: expressions are not allowed at the top level mainWindow.update(title: "Main Window") ^ error: fatalError
I’d love any suggestions on what’s going on. I feel like it is not related to my code, but maybe that’s just the optimistic newbie in me. :)
A second problem I’ve seen (on the same exercise) is that when a test fails, the expected value in the TEST FAILURE output section is different from the real expected value. You can see the real expected value in the top half of the screenshot.
Thanks for any help!
For you first question what you are suppose to do is to deffine a clousure more explict an Closures, they allow you to execute code withouit making a function, and they can be assaigned to a variable or constant.
I am not intending it to be this way, but I am working on other stuff, this is on my list and I have been aware of it, but it is not my priority mostly because it is quite far down in the syllabus tree. And at the moment I am prioritizng the beging.
As for your second question, I dont know why that is happening, the “-” at the end of the message says to me that it is not on our side. But I will do a double check. In general the test runner was rewritten for 1-2 months ago, being totally remasterd with better stabillty and new functionally. It is production ready but it still has some few things I like to patch, it did recive I think 3 patches since it launch and I will likely do another one in septemeber.
Alright yeah, something is up with the messaging part here, I think I made a fix a while back but didnt seem to have cover everything. Will try to make a patch under the weekend to fix it, but the messaging system is not part of the actuall test logic. So the test logic is working as intended.
I agree - the test logic is working as intended.
I’ll look at closures, thanks!
Alright I have made a pr with a patch, but only to fix this issue. The test runner missed picking up the last line for multi line strings, but with this update it should be fixed. I dont know when it will be merged but I wouldnt expect it to be merged until next week, but thanks for reporting.