{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleChrome/confluence/pulls/comments/114621334","pull_request_review_id":36103467,"id":114621334,"diff_hunk":"@@ -0,0 +1,248 @@\n+// Copyright 2017 The Chromium Authors. All rights reserved.\n+// Use of this source code is governed by a BSD-style license that can be\n+// found in the LICENSE file.\n+'use strict';\n+\n+describe('Set ops', () => {\n+  describe('SetMinus', () => {\n+    var MDAO;\n+    var SetMinus;\n+    var E;\n+    var Num;\n+    var mkNum;\n+    var EvilDAO;\n+    var ErrorDAO;\n+    beforeEach(() => {\n+      MDAO = foam.lookup('foam.dao.MDAO');\n+      SetMinus = foam.lookup('org.chromium.mlang.sink.SetMinus');\n+      E = foam.lookup('foam.mlang.ExpressionsSingleton').create();\n+\n+      foam.CLASS({\n+        package: 'org.chromium.mlang.sink.test',\n+        name: 'Num',\n+\n+        properties: [\n+          {\n+            class: 'Int',\n+            name: 'id',\n+          },\n+        ],\n+      });\n+\n+      Num = foam.lookup('org.chromium.mlang.sink.test.Num');\n+      mkNum = n => Num.create({id: n});\n+\n+      foam.CLASS({\n+        package: 'org.chromium.mlang.sink.test',\n+        name: 'EvilDAO',\n+        extends: 'foam.dao.ProxyDAO',\n+\n+        properties: [\n+          {\n+            class: 'Boolean',\n+            name: 'slow',\n+          },\n+        ],\n+\n+        methods: [\n+          function find(objOrId) {\n+            var promise;\n+            if (this.slow) {\n+              promise = new Promise(\n+                  (resolve, reject) => setTimeout(\n+                      () => this.delegate.find(objOrId).then(resolve, reject),\n+                      100));\n+            } else {\n+              promise = this.delegate.find(objOrId);\n+            }\n+\n+            this.slow = !this.slow;\n+            return promise;\n+          },\n+        ],\n+      });\n+\n+      EvilDAO = foam.lookup('org.chromium.mlang.sink.test.EvilDAO');\n+\n+      foam.CLASS({\n+        package: 'org.chromium.mlang.sink.test',\n+        name: 'ErrorDAO',\n+        extends: 'foam.dao.ProxyDAO',\n+\n+        methods: [\n+          function select() {\n+            return Promise.reject(new Error('ErrorDAO: Error on select()'));\n+          },\n+          function find() {\n+            return Promise.reject(new Error('ErrorDAO: Error on find()'));\n+          },\n+        ],\n+      });\n+\n+      ErrorDAO = foam.lookup('org.chromium.mlang.sink.test.ErrorDAO');\n+    });\n+\n+    it('should yield full set on SET_MINUS(nullSet)', done => {\n+      var set = MDAO.create({of: Num});\n+      var nullSet = MDAO.create({of: Num});\n+\n+      for (var i = 0; i < 10; i++) {\n+        set.put(mkNum(i));\n+      }\n+\n+      set.orderBy(Num.ID).select(E.SET_MINUS(nullSet))\n+          .then(setMinusSink => setMinusSink.getSink())\n+          .then(sink => {\n+            var array = sink.a;\n+            expect(array.length).toBe(10);\n+            for (var i = 0; i < 10; i++) {\n+              expect(array[i].id).toBe(i);\n+            }\n+\n+            done();\n+          });\n+    });\n+\n+    it('should yield full set on SET_MINUS(nullSet)', done => {\n+      var set = MDAO.create({of: Num});\n+      var nullSet = MDAO.create({of: Num});\n+\n+      for (var i = 0; i < 10; i++) {\n+        set.put(mkNum(i));\n+      }\n+\n+      set.orderBy(Num.ID).select(E.SET_MINUS(nullSet))\n+          .then(setMinusSink=> setMinusSink.getSink())\n+          .then(sink => {\n+            var array = sink.a;\n+            expect(array.length).toBe(10);\n+            for (var i = 0; i < 10; i++) {\n+              expect(array[i].id).toBe(i);\n+            }\n+\n+            done();\n+          });\n+    });\n+\n+    it('should remove all items when sets are identical', done => {\n+      var set = MDAO.create({of: Num});\n+      var subtrahend = MDAO.create({of: Num});\n+\n+      for (var i = 0; i < 10; i++) {\n+        set.put(mkNum(i));\n+        subtrahend.put(mkNum(i));\n+      }\n+\n+      set.select(E.SET_MINUS(subtrahend))\n+          .then(setMinusSink => setMinusSink.getSink())\n+          .then(sink => {\n+            var array = sink.a;\n+            expect(array.length).toBe(0);\n+\n+            done();\n+          });\n+    });\n+\n+    it('should remove some items when there is overlap', done => {\n+      var set = MDAO.create({of: Num});\n+      var subtrahend = MDAO.create({of: Num});\n+\n+      for (var i = 0; i < 10; i++) {\n+        set.put(mkNum(i));\n+        if ((i % 2) === 0) {\n+          subtrahend.put(mkNum(i));\n+        }\n+      }\n+\n+      set.orderBy(Num.ID).select(E.SET_MINUS(subtrahend))\n+          .then(setMinusSink =>setMinusSink.getSink())\n+          .then(sink => {\n+            var array = sink.a;\n+            expect(array.length).toBe(5);","path":"test/any/confluence/set_ops-test.es6.js","position":null,"original_position":161,"commit_id":"726267a5010068d354fa7c33f57cbba1d2875b17","original_commit_id":"c6823f14524636e68b551b68d03e1df84ed5b14a","user":{"login":"mdittmer","id":1775176,"avatar_url":"https://avatars0.githubusercontent.com/u/1775176?v=3","gravatar_id":"","url":"https://api.github.com/users/mdittmer","html_url":"https://github.com/mdittmer","followers_url":"https://api.github.com/users/mdittmer/followers","following_url":"https://api.github.com/users/mdittmer/following{/other_user}","gists_url":"https://api.github.com/users/mdittmer/gists{/gist_id}","starred_url":"https://api.github.com/users/mdittmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdittmer/subscriptions","organizations_url":"https://api.github.com/users/mdittmer/orgs","repos_url":"https://api.github.com/users/mdittmer/repos","events_url":"https://api.github.com/users/mdittmer/events{/privacy}","received_events_url":"https://api.github.com/users/mdittmer/received_events","type":"User","site_admin":false},"body":"It is; pushed simplified expectations. PTAL.","created_at":"2017-05-03T18:37:46Z","updated_at":"2017-05-03T18:37:46Z","html_url":"https://github.com/GoogleChrome/confluence/pull/53#discussion_r114621334","pull_request_url":"https://api.github.com/repos/GoogleChrome/confluence/pulls/53","_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/confluence/pulls/comments/114621334"},"html":{"href":"https://github.com/GoogleChrome/confluence/pull/53#discussion_r114621334"},"pull_request":{"href":"https://api.github.com/repos/GoogleChrome/confluence/pulls/53"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleChrome/confluence/pulls/53","id":118815901,"html_url":"https://github.com/GoogleChrome/confluence/pull/53","diff_url":"https://github.com/GoogleChrome/confluence/pull/53.diff","patch_url":"https://github.com/GoogleChrome/confluence/pull/53.patch","issue_url":"https://api.github.com/repos/GoogleChrome/confluence/issues/53","number":53,"state":"open","locked":false,"title":"Sink for set operation: SET_MINUS(subtrahendDAO)","user":{"login":"mdittmer","id":1775176,"avatar_url":"https://avatars0.githubusercontent.com/u/1775176?v=3","gravatar_id":"","url":"https://api.github.com/users/mdittmer","html_url":"https://github.com/mdittmer","followers_url":"https://api.github.com/users/mdittmer/followers","following_url":"https://api.github.com/users/mdittmer/following{/other_user}","gists_url":"https://api.github.com/users/mdittmer/gists{/gist_id}","starred_url":"https://api.github.com/users/mdittmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdittmer/subscriptions","organizations_url":"https://api.github.com/users/mdittmer/orgs","repos_url":"https://api.github.com/users/mdittmer/repos","events_url":"https://api.github.com/users/mdittmer/events{/privacy}","received_events_url":"https://api.github.com/users/mdittmer/received_events","type":"User","site_admin":false},"body":"This abstraction should greatly simplify the business logic in `lib/confluence` metrics.","created_at":"2017-05-03T17:41:01Z","updated_at":"2017-05-03T18:37:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"13e5d0ece8350efa53940c49f82f7bec0d6ef714","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleChrome/confluence/pulls/53/commits","review_comments_url":"https://api.github.com/repos/GoogleChrome/confluence/pulls/53/comments","review_comment_url":"https://api.github.com/repos/GoogleChrome/confluence/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleChrome/confluence/issues/53/comments","statuses_url":"https://api.github.com/repos/GoogleChrome/confluence/statuses/726267a5010068d354fa7c33f57cbba1d2875b17","head":{"label":"GoogleChrome:set-minus","ref":"set-minus","sha":"726267a5010068d354fa7c33f57cbba1d2875b17","user":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars0.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"repo":{"id":82467989,"name":"confluence","full_name":"GoogleChrome/confluence","owner":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars0.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleChrome/confluence","description":null,"fork":false,"url":"https://api.github.com/repos/GoogleChrome/confluence","forks_url":"https://api.github.com/repos/GoogleChrome/confluence/forks","keys_url":"https://api.github.com/repos/GoogleChrome/confluence/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleChrome/confluence/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleChrome/confluence/teams","hooks_url":"https://api.github.com/repos/GoogleChrome/confluence/hooks","issue_events_url":"https://api.github.com/repos/GoogleChrome/confluence/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleChrome/confluence/events","assignees_url":"https://api.github.com/repos/GoogleChrome/confluence/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleChrome/confluence/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleChrome/confluence/tags","blobs_url":"https://api.github.com/repos/GoogleChrome/confluence/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleChrome/confluence/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleChrome/confluence/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleChrome/confluence/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleChrome/confluence/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleChrome/confluence/languages","stargazers_url":"https://api.github.com/repos/GoogleChrome/confluence/stargazers","contributors_url":"https://api.github.com/repos/GoogleChrome/confluence/contributors","subscribers_url":"https://api.github.com/repos/GoogleChrome/confluence/subscribers","subscription_url":"https://api.github.com/repos/GoogleChrome/confluence/subscription","commits_url":"https://api.github.com/repos/GoogleChrome/confluence/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleChrome/confluence/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleChrome/confluence/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleChrome/confluence/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleChrome/confluence/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleChrome/confluence/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleChrome/confluence/merges","archive_url":"https://api.github.com/repos/GoogleChrome/confluence/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleChrome/confluence/downloads","issues_url":"https://api.github.com/repos/GoogleChrome/confluence/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleChrome/confluence/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleChrome/confluence/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleChrome/confluence/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleChrome/confluence/labels{/name}","releases_url":"https://api.github.com/repos/GoogleChrome/confluence/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleChrome/confluence/deployments","created_at":"2017-02-19T15:16:33Z","updated_at":"2017-05-03T15:58:50Z","pushed_at":"2017-05-03T18:37:24Z","git_url":"git://github.com/GoogleChrome/confluence.git","ssh_url":"git@github.com:GoogleChrome/confluence.git","clone_url":"https://github.com/GoogleChrome/confluence.git","svn_url":"https://github.com/GoogleChrome/confluence","homepage":null,"size":2111,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":24,"forks":3,"open_issues":24,"watchers":7,"default_branch":"master"}},"base":{"label":"GoogleChrome:master","ref":"master","sha":"4ec8e009f00368f3f42300bd7c6fe7c5a8e17fe0","user":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars0.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"repo":{"id":82467989,"name":"confluence","full_name":"GoogleChrome/confluence","owner":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars0.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleChrome/confluence","description":null,"fork":false,"url":"https://api.github.com/repos/GoogleChrome/confluence","forks_url":"https://api.github.com/repos/GoogleChrome/confluence/forks","keys_url":"https://api.github.com/repos/GoogleChrome/confluence/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleChrome/confluence/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleChrome/confluence/teams","hooks_url":"https://api.github.com/repos/GoogleChrome/confluence/hooks","issue_events_url":"https://api.github.com/repos/GoogleChrome/confluence/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleChrome/confluence/events","assignees_url":"https://api.github.com/repos/GoogleChrome/confluence/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleChrome/confluence/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleChrome/confluence/tags","blobs_url":"https://api.github.com/repos/GoogleChrome/confluence/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleChrome/confluence/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleChrome/confluence/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleChrome/confluence/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleChrome/confluence/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleChrome/confluence/languages","stargazers_url":"https://api.github.com/repos/GoogleChrome/confluence/stargazers","contributors_url":"https://api.github.com/repos/GoogleChrome/confluence/contributors","subscribers_url":"https://api.github.com/repos/GoogleChrome/confluence/subscribers","subscription_url":"https://api.github.com/repos/GoogleChrome/confluence/subscription","commits_url":"https://api.github.com/repos/GoogleChrome/confluence/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleChrome/confluence/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleChrome/confluence/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleChrome/confluence/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleChrome/confluence/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleChrome/confluence/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleChrome/confluence/merges","archive_url":"https://api.github.com/repos/GoogleChrome/confluence/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleChrome/confluence/downloads","issues_url":"https://api.github.com/repos/GoogleChrome/confluence/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleChrome/confluence/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleChrome/confluence/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleChrome/confluence/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleChrome/confluence/labels{/name}","releases_url":"https://api.github.com/repos/GoogleChrome/confluence/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleChrome/confluence/deployments","created_at":"2017-02-19T15:16:33Z","updated_at":"2017-05-03T15:58:50Z","pushed_at":"2017-05-03T18:37:24Z","git_url":"git://github.com/GoogleChrome/confluence.git","ssh_url":"git@github.com:GoogleChrome/confluence.git","clone_url":"https://github.com/GoogleChrome/confluence.git","svn_url":"https://github.com/GoogleChrome/confluence","homepage":null,"size":2111,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":24,"forks":3,"open_issues":24,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/confluence/pulls/53"},"html":{"href":"https://github.com/GoogleChrome/confluence/pull/53"},"issue":{"href":"https://api.github.com/repos/GoogleChrome/confluence/issues/53"},"comments":{"href":"https://api.github.com/repos/GoogleChrome/confluence/issues/53/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleChrome/confluence/pulls/53/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleChrome/confluence/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleChrome/confluence/pulls/53/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleChrome/confluence/statuses/726267a5010068d354fa7c33f57cbba1d2875b17"}}}}
{"actor":{"display_login":"mdittmer"}}