Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The closures lesson doesn't validate properly #9

Open
Dannnno opened this issue Jul 28, 2015 · 5 comments
Open

The closures lesson doesn't validate properly #9

Dannnno opened this issue Jul 28, 2015 · 5 comments

Comments

@Dannnno
Copy link

Dannnno commented Jul 28, 2015

With the following code

function foo () {
    var bar = 2;
    quuz = 13;
    function zip () {
        var quux = 9;
        bar = true;
    }
    return zip;
}

I get the output

not ok 2 The structure is correct
  ---
    operator: equal
    expected:
      '(global)\n\tfoo()\n\t- var bar\n\t- quux = ?\n\treturn zip\n\t\tzip()\n\t\t- var quux\n\t\t- bar = ?'
    actual:
      '(global)\n\tfoo()\n\t- var bar\n\t- quux = ?\n\treturn zip\n\t\tzip()\n\t\t- var quux\n\t\t- bar = ?'
@jesstelford
Copy link
Collaborator

You've got a typo on line 3:

quuz = 13

Should be

quux = 13

@Dannnno
Copy link
Author

Dannnno commented Jul 28, 2015

Well... This is embarassing...

Have you considered adding a diff tool to show where the difference is?

@Dannnno Dannnno closed this as completed Jul 28, 2015
@jesstelford
Copy link
Collaborator

Yeah, better output is definitely needed. Currently it's just a string comparison and fails if they're not equal.

Do you know of any string diffing tools I could use with tape (the test runner which verifies the solution)?

@Dannnno
Copy link
Author

Dannnno commented Jul 29, 2015

Potentially tap-prettify or tap-difflet?

@Dannnno Dannnno reopened this Jul 29, 2015
@SomeoneWeird
Copy link
Member

I think the difficulty in diff'ing is that we're basically comparing a simpler AST representation to your solution - which doesn't keep formatting etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants