{"action":"created","issue":{"url":"https://api.github.com/repos/neovim/neovim/issues/1835","labels_url":"https://api.github.com/repos/neovim/neovim/issues/1835/labels{/name}","comments_url":"https://api.github.com/repos/neovim/neovim/issues/1835/comments","events_url":"https://api.github.com/repos/neovim/neovim/issues/1835/events","html_url":"https://github.com/neovim/neovim/pull/1835","id":54659976,"number":1835,"title":"[WIP/RFC] snapshot utility (aka Screen Tests for the Lazy)","user":{"login":"bfredl","id":1363104,"avatar_url":"https://avatars.githubusercontent.com/u/1363104?v=3","gravatar_id":"","url":"https://api.github.com/users/bfredl","html_url":"https://github.com/bfredl","followers_url":"https://api.github.com/users/bfredl/followers","following_url":"https://api.github.com/users/bfredl/following{/other_user}","gists_url":"https://api.github.com/users/bfredl/gists{/gist_id}","starred_url":"https://api.github.com/users/bfredl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bfredl/subscriptions","organizations_url":"https://api.github.com/users/bfredl/orgs","repos_url":"https://api.github.com/users/bfredl/repos","events_url":"https://api.github.com/users/bfredl/events{/privacy}","received_events_url":"https://api.github.com/users/bfredl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-17T12:10:59Z","updated_at":"2015-01-17T13:04:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/neovim/neovim/pulls/1835","html_url":"https://github.com/neovim/neovim/pull/1835","diff_url":"https://github.com/neovim/neovim/pull/1835.diff","patch_url":"https://github.com/neovim/neovim/pull/1835.patch"},"body":"This defines a utility function `screen:snapshot_util()` that can be placed in an screen test file at any point where one would like to have a `screen:expect([...])` and it will spit out such a statement to stdout that would match the current screen state exactly.\r\n\r\nIn a fresh vim, it for instance prints:\r\n```\r\nscreen:expect([[\r\n  ^                                                    |\r\n  {1:~                                                    }|\r\n  {1:~                                                    }|\r\n  {1:~                                                    }|\r\n  {1:~                                                    }|\r\n  {1:~                                                    }|\r\n  {1:~                                                    }|\r\n  {1:~                                                    }|\r\n  {1:~                                                    }|\r\n  {1:~                                                    }|\r\n  {1:~                                                    }|\r\n  {1:~                                                    }|\r\n  {1:~                                                    }|\r\n                                                       |\r\n]], {[1] = {bold = true, foreground = 255}})\r\n```\r\n\r\nBut I'm not really happy it yet, due to what I perceive as a limitation of `screen:except` itself. If I understand it correctly, it will not be able to detect that a previously unhighlighted area incorrectly gets new a new, unexpected highlighting, say, the middle of the first line suddenly gets the background color 156. (Unless, of course, one also wraps all unhighlighted areas with some `{N:` and `}`, but that would be just clumsy). \r\n\r\nInstead, when `attr_ids` is specified to `expect`, I think an entirely unexpected attr set should be a test failure, where one for convenience could be able to to specify that some allowed attr sets should be just ignored (for instance, the `bold+fg=255` that every entire empty line is highlighted with :) )"},"comment":{"url":"https://api.github.com/repos/neovim/neovim/issues/comments/70366250","html_url":"https://github.com/neovim/neovim/pull/1835#issuecomment-70366250","issue_url":"https://api.github.com/repos/neovim/neovim/issues/1835","id":70366250,"user":{"login":"tarruda","id":842846,"avatar_url":"https://avatars.githubusercontent.com/u/842846?v=3","gravatar_id":"","url":"https://api.github.com/users/tarruda","html_url":"https://github.com/tarruda","followers_url":"https://api.github.com/users/tarruda/followers","following_url":"https://api.github.com/users/tarruda/following{/other_user}","gists_url":"https://api.github.com/users/tarruda/gists{/gist_id}","starred_url":"https://api.github.com/users/tarruda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tarruda/subscriptions","organizations_url":"https://api.github.com/users/tarruda/orgs","repos_url":"https://api.github.com/users/tarruda/repos","events_url":"https://api.github.com/users/tarruda/events{/privacy}","received_events_url":"https://api.github.com/users/tarruda/received_events","type":"User","site_admin":false},"created_at":"2015-01-17T13:04:02Z","updated_at":"2015-01-17T13:04:02Z","body":"> I already wait 250 msec in snapshot_util itself, I meant the issue is with expect itself, when it sees some highlighting that is not defined in attr_ids it just ignores it, while I think it should be a failure (execpt for some whitelist of ignored highlights). This has nothing to do with the wait mechanism at all. To better explain what I mean I will try implement it.\r\n\r\nSince you return nil from the callback passed to `wait`, it will return after the first notification. If more notifications come after that they will be lost. You must return an error string to make sure the full 250 ms are passed."}}