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

TestIsEmptyClause fails #51

Closed
chrisdusovic opened this issue Jun 10, 2016 · 2 comments
Closed

TestIsEmptyClause fails #51

chrisdusovic opened this issue Jun 10, 2016 · 2 comments
Labels

Comments

@chrisdusovic
Copy link
Contributor

chrisdusovic commented Jun 10, 2016

In bql/semantic/semantic_test.go, there is a typo in a test name that causes it to be ignored:

func TesIsEmptyClause(t *testing.T) {
    testTable := []struct {
        in  *GraphClause
        out bool
    }{
        {
            in:  &GraphClause{},
            out: true,
        },
        {
            in:  &GraphClause{SBinding: "?foo"},
            out: true,
        },
    }
    for _, entry := range testTable {
        if got, want := entry.in.IsEmpty(), entry.out; got != want {
            t.Errorf("IsEmpty for %v returned %v, but should have returned %v", entry.in, got, want)
        }
    }

}

After changing the name to the proper TestIsEmptyClause and running the tests, the test fails:

--- FAIL: TestIsEmptyClause (0.00s)
    semantic_test.go:148: IsEmpty for &{<nil> ?foo    <nil>       <nil> <nil>   false <nil>        <nil> <nil>   false} returned false, but should have returned true
FAIL
FAIL    github.com/google/badwolf/bql/semantic  0.028s
@chrisdusovic
Copy link
Contributor Author

It seems the issue stems from the test asserting that &GraphClause{SBinding: "?foo"} should be an empty GraphClause based on this block:

{
            in:  &GraphClause{SBinding: "?foo"},
            out: true,
},

However, the GraphClause is not empty because its SBinding field is set. Therefore, the block should instead contain:

{
            in:  &GraphClause{SBinding: "?foo"},
            out: false,
},

This change causes the test to pass.

@xllora
Copy link
Member

xllora commented Jun 11, 2016

Good catch.

@xllora xllora added the bug label Jun 11, 2016
@xllora xllora closed this as completed in 7f7d399 Jun 14, 2016
xllora added a commit that referenced this issue Jun 14, 2016
Fix non running test on described on issue #51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants