From 906180e94bcc5dc09c146c1041df0f135e11b89b Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 28 Dec 2019 14:23:48 +0000 Subject: test for Store --- t/fixtures/one/cur/1 | 35 ++++++++++++++++++++++++ t/fixtures/one/cur/2 | 48 +++++++++++++++++++++++++++++++++ t/fixtures/one/cur/3 | 28 ++++++++++++++++++++ t/fixtures/one/cur/4 | 51 +++++++++++++++++++++++++++++++++++ t/fixtures/two/cur/1 | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ t/fixtures/two/cur/2 | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ t/lib/TestIndex.pm6 | 32 ++++++++++++++++++++++ t/store.t | 33 +++++++++++++++++++++++ 8 files changed, 372 insertions(+) create mode 100644 t/fixtures/one/cur/1 create mode 100644 t/fixtures/one/cur/2 create mode 100644 t/fixtures/one/cur/3 create mode 100644 t/fixtures/one/cur/4 create mode 100644 t/fixtures/two/cur/1 create mode 100644 t/fixtures/two/cur/2 create mode 100644 t/lib/TestIndex.pm6 create mode 100644 t/store.t diff --git a/t/fixtures/one/cur/1 b/t/fixtures/one/cur/1 new file mode 100644 index 0000000..c625c34 --- /dev/null +++ b/t/fixtures/one/cur/1 @@ -0,0 +1,35 @@ +Return-Path: +Delivered-To: dakkar-doodle@example.com +Received: (qmail 5146 invoked from network); 23 Dec 2019 15:20:38 -0000 +Received: from unknown (HELO o7.ptr5064.doodle.com) (::ffff:192.254.126.109) + by 0 with ESMTPS (ECDHE-RSA-AES128-GCM-SHA256 encrypted); 23 Dec 2019 15:20:38 -0000 +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=e.doodle.com; + h=content-type:from:mime-version:to:subject; s=s1; + bh=PcsODplMljQHOaTYyF91kq8OVnw9nn2JPWNW3eyfpPw=; b=kVKUfE8wsAHL0 + Tf9wLJ9vfaKrfXmo0eA6W4Wg4UvvPWPRyYMOlGti8zSspHGWOg6Onb5LdQT6m3Z8 + MzBkm8RiY63N0iGBCNR0Q2KuXzA84MVOrBEw7Qn2bnG9QusfDqOVYMTYLW9+nK2i + e7ZuWZ9DWxEMfMfv1RV2OGOhf4EdW0= +Received: by filter0829p1las1.sendgrid.net with SMTP id filter0829p1las1-7370-5E00DB3E-4A + 2019-12-23 15:20:30.977516381 +0000 UTC m=+499232.156002364 +Received: from NjAxOTg1Ng (ec2-34-241-175-170.eu-west-1.compute.amazonaws.com [34.241.175.170]) + by ismtpd0007p1lon1.sendgrid.net (SG) with HTTP id vEOG711WRxSn_BfomKVM1g + Mon, 23 Dec 2019 15:20:30.986 +0000 (UTC) +Content-Type: multipart/alternative; boundary=938ce52f14920204d1e1a148dd23f4260eaa6e78080a898d2f0b298ccc58 +Date: Mon, 23 Dec 2019 15:20:31 +0000 (UTC) +From: "Doodle" +Mime-Version: 1.0 +To: "Gianni Ceccarelli" +Message-ID: +Subject: Doodle: Weathering with You +X-SG-EID: VHJOoBsVjlfd+Y93kxyhzwEw7FUms5IVLlIOb6EqWpGBFSOwrm5C+/ouaYiLNw5HpaTsAL/xLAceub + F5yjVdFgrCgec3jlxm/oh3tUvfk49HUgOFHp9ljS1IUiywhSv3oBpB6aTOUR3kpNCmRRoenkwgE2dI + R69mEUODZACcNAj+/9Rinh4uPG8G+X41WfR8hBaU7IG+ZOQU+h0F0FiBjk/Sl6p+8IkASXuDFc4+5s + Q= +X-SG-ID: irgk8BIL43PL9bWaRMcQw9m5V+JggaoUZjNMk7etbqA= + +--938ce52f14920204d1e1a148dd23f4260eaa6e78080a898d2f0b298ccc58 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/plain; charset=UTF-8 +Mime-Version: 1.0 + +---- diff --git a/t/fixtures/one/cur/2 b/t/fixtures/one/cur/2 new file mode 100644 index 0000000..3550004 --- /dev/null +++ b/t/fixtures/one/cur/2 @@ -0,0 +1,48 @@ +Return-Path: +Delivered-To: dakkar@example.com +Received: (qmail 3881 invoked by uid 1016); 23 Dec 2019 23:07:25 -0000 +Received: (qmail 3873 invoked from network); 23 Dec 2019 23:07:23 -0000 +Received: from unknown (HELO mr85p00im-hyfv06011401.me.com) (::ffff:17.58.23.191) + by 0 with ESMTPS (ECDHE-RSA-AES256-GCM-SHA384 encrypted); 23 Dec 2019 23:07:23 -0000 +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; + s=1a1hai; t=1577142442; + bh=L1tMg63ZzlMmL1Z5E5YIscFKgdAVqf5UceSNY4ToMXQ=; + h=Content-Type:From:Subject:Date:Message-Id:To; + b=c7kEnI3IN3oZ99hxMudP/tr8piuZj1TYjjWCTGPXRUAhk9tA5c6PtwCcjSksyMV/u + jhSZ/0+aRDnRn8q9mSRvJP0EQo/IIF4FdYODDMDS15Jf/Ju+qoSwqwVEz0lXnabkih + kh8j3JXGEY384FOGdBOvxED8E/8t2rzlIatu1iHnDzZJUU9VxPj1WhxY4/PBsdbg9y + oWH5RSSV1afoZE/M+QqKpx+ggHkk6VJGjX64qdl93APi/ax5i0YjdeQva3ifvX4j/3 + ZXUOpRGt1kTkXI6E3IUIt8DwGaoGgtKWLLl9XEyr22SWIHeOABian18fn2Mr2jbdrQ + kmcOlm37IZaZQ== +Received: from [192.168.1.4] (cpc110667-lewi19-2-0-cust182.2-4.cable.virginm.net [80.7.252.183]) + by mr85p00im-hyfv06011401.me.com (Postfix) with ESMTPSA id EB60CD209D8 + for ; Mon, 23 Dec 2019 23:07:21 +0000 (UTC) +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +From: Some Guy +Mime-Version: 1.0 (1.0) +Subject: Re: [Anime] First Anime Day of 2020: January 25th +Date: Mon, 23 Dec 2019 23:07:19 +0000 +Message-Id: +References: <20191223152132.05c934ca@example.com> +In-Reply-To: <20191223152132.05c934ca@example.com> +To: anime-london@example.com +X-Mailer: iPhone Mail (17C54) +X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-12-23_10:,, + signatures=0 +X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 + phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 + mlxlogscore=732 adultscore=0 classifier=spam adjust=0 reason=mlx + scancount=1 engine=8.0.1-1908290000 definitions=main-1912230202 +X-Been-There: anime-london-bounce@example.com +Reply-To: anime-london@example.com +List-Id: anime-london +List-Owner: +List-Post: +List-Subscribe: + +List-Unsubscribe: + + +Done, and sounds good. How do I book tickets? + diff --git a/t/fixtures/one/cur/3 b/t/fixtures/one/cur/3 new file mode 100644 index 0000000..b4197d5 --- /dev/null +++ b/t/fixtures/one/cur/3 @@ -0,0 +1,28 @@ +Return-Path: +Delivered-To: dakkar@example.com +Received: (qmail 23801 invoked by uid 1016); 24 Dec 2019 09:44:10 -0000 +Received: (qmail 23795 invoked from network); 24 Dec 2019 09:44:09 -0000 +Received: from unknown (HELO localhost) (dakkar@::ffff:10.111.0.42) + by 0 with ESMTPA; 24 Dec 2019 09:44:09 -0000 +Date: Tue, 24 Dec 2019 09:44:06 +0000 +From: Gianni Ceccarelli +To: anime-london@example.com +Subject: Re: [Anime] First Anime Day of 2020: January 25th +Message-ID: <20191224094406.6fe89e1d@example.com> +In-Reply-To: +References: <20191223152132.05c934ca@example.com> + +X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) +MIME-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Been-There: anime-london-bounce@example.com +Reply-To: anime-london@example.com +List-Id: anime-london +List-Owner: +List-Post: +List-Subscribe: + +List-Unsubscribe: + + diff --git a/t/fixtures/one/cur/4 b/t/fixtures/one/cur/4 new file mode 100644 index 0000000..1014d5a --- /dev/null +++ b/t/fixtures/one/cur/4 @@ -0,0 +1,51 @@ +Return-Path: +Delivered-To: dakkar@example.com +Received: (qmail 24198 invoked by uid 1016); 25 Dec 2019 06:17:11 -0000 +Received: (qmail 24188 invoked from network); 25 Dec 2019 06:17:08 -0000 +Received: from unknown (HELO mr85p00im-ztdg06011801.me.com) (::ffff:17.58.23.199) + by 0 with ESMTPS (ECDHE-RSA-AES256-GCM-SHA384 encrypted); 25 Dec 2019 06:17:08 -0000 +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; + s=1a1hai; t=1577254627; + bh=KHjA2+p5Ppj86OLUh8ykXLLJa3vi6JYG0eMyJN//dKg=; + h=Content-Type:From:Subject:Date:Message-Id:To; + b=ALTI56A8R4Zc12eVAxV4gE+ME4NWW4zvFdfyVN73JsLY0qc6ekeGFMWGSQ/r5thnO + SumGMzpGJshFV2pGIxD926/EVH8qteIRuQiGwYvSbpuGNi5xa/Wwq/gox38WFMrBnH + l+h1MUpqsdJ/BmsdLKSnP8tK4sSOa4s95hQBcVsJa2FVfnpBa6euIkTqYvJmjfRCGC + eN3jIToLMN6Rnv8Mtz4g7/7OnIpBtu43Jn33+1IzYAdycfaGVuhfMv0v84KYqbRfF3 + Jyr7j+mASUi3yYWPm3vosMHpgdzljHWK7b0X/kKGst8ViVMIlYy1Ysh8p6TTLhhWSy + hGgPUbu81zGuA== +Received: from [192.168.1.4] (cpc110667-lewi19-2-0-cust182.2-4.cable.virginm.net [80.7.252.183]) + by mr85p00im-ztdg06011801.me.com (Postfix) with ESMTPSA id 1BF49C08AB + for ; Wed, 25 Dec 2019 06:17:07 +0000 (UTC) +Content-Type: multipart/alternative; boundary=Apple-Mail-EBE85745-2610-4D8D-8B1D-29A7640DF607 +Content-Transfer-Encoding: 7bit +From: Some Guy +Mime-Version: 1.0 (1.0) +Subject: Re: [Anime] First Anime Day of 2020: January 25th +Date: Wed, 25 Dec 2019 06:17:05 +0000 +Message-Id: <4DEA4178-32A0-4AFB-8B23-250E6D785FD8@icloud.com> +References: <20191224094406.6fe89e1d@example.com> +In-Reply-To: <20191224094406.6fe89e1d@example.com> +To: anime-london@example.com +X-Mailer: iPhone Mail (17C54) +X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-12-24_07:,, + signatures=0 +X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 + phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 + mlxlogscore=523 adultscore=0 classifier=spam adjust=0 reason=mlx + scancount=1 engine=8.0.1-1908290000 definitions=main-1912250049 +X-Been-There: anime-london-bounce@example.com +Reply-To: anime-london@example.com +List-Id: anime-london +List-Owner: +List-Post: +List-Subscribe: + +List-Unsubscribe: + + + +--Apple-Mail-EBE85745-2610-4D8D-8B1D-29A7640DF607 +Content-Type: text/plain; + charset=utf-8 +Content-Transfer-Encoding: quoted-printable diff --git a/t/fixtures/two/cur/1 b/t/fixtures/two/cur/1 new file mode 100644 index 0000000..c76057e --- /dev/null +++ b/t/fixtures/two/cur/1 @@ -0,0 +1,70 @@ +Return-Path: +Delivered-To: dakkar@example.com +Received: (qmail 11652 invoked from network); 23 Dec 2019 11:53:19 -0000 +Received: from unknown (HELO mail-ot1-x33e.google.com) (2607:f8b0:4864:20::33e) + by 0 with ESMTPS (TLS_AES_128_GCM_SHA256 encrypted); 23 Dec 2019 11:53:19 -0000 +Received: by mail-ot1-x33e.google.com with SMTP id 73sf8734138otj.10 + for ; Mon, 23 Dec 2019 03:53:19 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=googlegroups.com; s=20161025; + h=sender:date:from:to:message-id:in-reply-to:references:subject + :mime-version:x-original-sender:reply-to:precedence:mailing-list + :list-id:list-post:list-help:list-archive:list-subscribe + :list-unsubscribe; + bh=P3EVBgLqIcnw0xUfPiKVMwTF/S4REc9txUUbdlxYGag=; + b=q/42/TVG/mQNcRkmNEpXO53cc1bI1tOOk1mFWK2oDg0H/ssom2WJE81EkQU9woIJfc + M+ymz+I43eAFMJoje0f1UuaVyIrna1dlvTavvr7197rmZVD3y4a2Q7kBYSdtrV86LB2B + oP82+rKB/GlDcFeB9rytJMBl2z3TM+ZW8Ud3duoYiMUukDf3aqBm/BBGd8I2F28o/g6r + Apj9LL0LGapmfKPG54haZWGivsjsAQ6T2f9+9MVvX8vm2JWdaxGqzWJnNGEADy8ztnUq + woPc4XjLV3Ym/cOgVkCqwdDJ4uSK6tD6E73CHdJICBUgFyCslMWIUGkQqBYiRn8VwR7P + IJUQ== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20161025; + h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to + :references:subject:mime-version:x-original-sender:reply-to + :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post + :list-help:list-archive:list-subscribe:list-unsubscribe; + bh=P3EVBgLqIcnw0xUfPiKVMwTF/S4REc9txUUbdlxYGag=; + b=Gah6vy+bEidAByUikmFgVQP5poxKyDOBXiHk8pXITzdpS7hDaUHQ+BAQ5TgBxK13Qa + gQT03gvMB9hSp5EiWrOzbRCjw3KE6Oo2H6KUixw6sM63fTQp1HCB0aq56uFXZ948zYtQ + t2IqKPXVPLbP9rp35VtONkxuprXrTQe0FKtGaAf9vRgM6hE/Fl6GM9hRU3AeJeliRjxb + XMDG8N/7YuvZ8cX5xNl1GikElKODBmcpiWawk9+5xZKMCzSCsJltq2P+xspQmdiZHGoM + K0fPrd3xWF9OfEAqG7TiUPn6QhX5V/AHr6PRPXZA732Tsu3qsiyJhdulZcl9/jSP70Ov + 4f4Q== +Sender: london-hack-space@googlegroups.com +X-Gm-Message-State: APjAAAX3bjC83wB7avZqyhOGlgtkoxdINaaOCctGZMbodaI05/6T8u1e + 4nEmEdStqN9h10Z1SSTNOG8= +X-Google-Smtp-Source: APXvYqwX2MCQ/hkoBW7/hPsOZKYl5E2744XCmhlTaxWLB+EaQqRYSpaCHbN4yb8I8MmigALToRoOoA== +X-Received: by 2002:a9d:674f:: with SMTP id w15mr32770926otm.243.1577101998136; + Mon, 23 Dec 2019 03:53:18 -0800 (PST) +X-BeenThere: london-hack-space@googlegroups.com +Received: by 2002:a9d:714f:: with SMTP id y15ls4925056otj.14.gmail; Mon, 23 + Dec 2019 03:53:13 -0800 (PST) +X-Received: by 2002:a05:6830:1116:: with SMTP id w22mr32919934otq.216.1577101993780; + Mon, 23 Dec 2019 03:53:13 -0800 (PST) +Date: Mon, 23 Dec 2019 03:53:12 -0800 (PST) +From: Simon Person +To: London Hackspace +Message-Id: +In-Reply-To: <1d3ac952-ef7d-4dd5-9165-0c6b0b8ac3cc@googlegroups.com> +References: <1d3ac952-ef7d-4dd5-9165-0c6b0b8ac3cc@googlegroups.com> +Subject: [london-hack-space] Hack the Wood workshop day +MIME-Version: 1.0 +Content-Type: multipart/mixed; + boundary="----=_Part_867_1096556722.1577101993145" +X-Original-Sender: simon.person@person.org +Reply-To: london-hack-space@googlegroups.com +Precedence: list +Mailing-list: list london-hack-space@googlegroups.com; contact london-hack-space+owners@googlegroups.com +List-ID: +X-Spam-Checked-In-Group: london-hack-space@googlegroups.com +X-Google-Group-Id: 196336248237 +List-Post: , +List-Help: , +List-Archive: , +List-Unsubscribe: , + + +------=_Part_867_1096556722.1577101993145 +Content-Type: text/plain; charset="UTF-8" diff --git a/t/fixtures/two/cur/2 b/t/fixtures/two/cur/2 new file mode 100644 index 0000000..a0ea92d --- /dev/null +++ b/t/fixtures/two/cur/2 @@ -0,0 +1,75 @@ +Return-Path: +Delivered-To: dakkar@example.com +Received: (qmail 17776 invoked from network); 23 Dec 2019 12:40:58 -0000 +Received: from unknown (HELO mail-oi1-x237.google.com) (2607:f8b0:4864:20::237) + by 0 with ESMTPS (TLS_AES_128_GCM_SHA256 encrypted); 23 Dec 2019 12:40:58 -0000 +Received: by mail-oi1-x237.google.com with SMTP id e22sf4158385oig.1 + for ; Mon, 23 Dec 2019 04:40:58 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=googlegroups.com; s=20161025; + h=sender:date:from:to:message-id:subject:mime-version + :x-original-sender:reply-to:precedence:mailing-list:list-id + :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; + bh=Ri5yf2PROgSFWlFDOgXygwVGnfHWofjeUQ44kgBBOUE=; + b=Bp0uQsNeJdmrgEXvO+qigTMP4r2HnVwnuJ27h3pBnPATZHyWw6aIuTpgCWIWr66aX9 + LzqLgtUKNXaXW63B/pXXKNvWw72SxSbVuu0XDDlrXnfVwkwKpyBfB54Z+rIGtXBL6cz+ + HLucu0dRtVsGdvtzXOsXE3MSb82yj4X8iCrQ7uSPCrXN/BJB1Rhk7Zt+/K6T9XxI7Xs3 + 5N66h0UJ6gGzYg+jlTOQefcB0bdgZJF1v74Z7Nkx1aMH7+uMl/aNv/gxCJ83gGPs9LcA + tuAdDFZHVGYicfPTkwEk+FHurgkDWy6HD0GX6XMR6P0fRVEo3onY8MkRT3KAtIEu+FDy + 8R2A== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20161025; + h=sender:x-gm-message-state:date:from:to:message-id:subject + :mime-version:x-original-sender:reply-to:precedence:mailing-list + :list-id:list-post:list-help:list-archive:list-subscribe + :list-unsubscribe; + bh=Ri5yf2PROgSFWlFDOgXygwVGnfHWofjeUQ44kgBBOUE=; + b=SpSrbDzNmU1+uPejIM5Uj3h2SbenpD1g+aZLMjTWPngieau2GVB3hixFhXqZeEX8W3 + PCVwqZNOPlUMhuRRe86u1iequa6tA8t2iCFAAk/6yG4KC5VWgrqC6tvCrrj4ANqQ3atw + XR/OzUliZCzUsWxEbNHgMEoFxZdP3FyKU73hbIdxN892ivgmkus64Hc7DwgnDDPWbBtz + xUg9GqBJCcxHo988Q6oBL0f4RyQ47JYngpb0rWO6xPLnm84bfnn8GIISvky6ZVRK7w+f + S2H5Q9cR3Gn8mGSHk15tG7dYyq5c2NAr6CbHSL0kOYhdpbEH5QyH4L/Px3v9yNHwB/f/ + 4xEw== +Sender: london-hack-space@googlegroups.com +X-Gm-Message-State: APjAAAUQOrNPBixpa73WWUOw4HiaB3LgQKBsOPhz8kh54btkbyeGkXze + a47qQ1jIu3I2yYyR89Jw8Cg= +X-Google-Smtp-Source: APXvYqxpUsLos06PkpD8KXJo9Trqh//GgDH3kttizR/8g35oEcuTdRiTMWNgm5SEsBQb3aHMNRHlbQ== +X-Received: by 2002:a9d:730e:: with SMTP id e14mr30679137otk.62.1577104857209; + Mon, 23 Dec 2019 04:40:57 -0800 (PST) +X-BeenThere: london-hack-space@googlegroups.com +Received: by 2002:a9d:714f:: with SMTP id y15ls4959546otj.14.gmail; Mon, 23 + Dec 2019 04:40:53 -0800 (PST) +X-Received: by 2002:a9d:7a97:: with SMTP id l23mr28418769otn.34.1577104853226; + Mon, 23 Dec 2019 04:40:53 -0800 (PST) +Received: by 2002:aca:51ce:0:0:0:0:0 with SMTP id f197msoib; + Mon, 23 Dec 2019 04:33:17 -0800 (PST) +X-Received: by 2002:aca:48cf:: with SMTP id v198mr5817473oia.35.1577104397357; + Mon, 23 Dec 2019 04:33:17 -0800 (PST) +Date: Mon, 23 Dec 2019 04:33:17 -0800 (PST) +From: Alex Guy +To: London Hackspace +Message-Id: <12e79d77-5291-49eb-bdba-5a15e20dfb40@googlegroups.com> +Subject: [london-hack-space] I moved a large (1/2"?) nut from the metal shop + to the wood shop to attach hole saws to the drill press +MIME-Version: 1.0 +Content-Type: multipart/mixed; + boundary="----=_Part_413_161309431.1577104397176" +X-Original-Sender: alex.guy@gmail.com +Reply-To: london-hack-space@googlegroups.com +Precedence: list +Mailing-list: list london-hack-space@googlegroups.com; contact london-hack-space+owners@googlegroups.com +List-ID: +X-Google-Group-Id: 196336248237 +List-Post: , +List-Help: , +List-Archive: , +List-Unsubscribe: , + + +------=_Part_413_161309431.1577104397176 +Content-Type: multipart/alternative; + boundary="----=_Part_414_1512994295.1577104397176" + +------=_Part_414_1512994295.1577104397176 +Content-Type: text/plain; charset="UTF-8" diff --git a/t/lib/TestIndex.pm6 b/t/lib/TestIndex.pm6 new file mode 100644 index 0000000..730ee92 --- /dev/null +++ b/t/lib/TestIndex.pm6 @@ -0,0 +1,32 @@ +use v6.d; +use MaildirIndexer::Index; + +unit class TestIndex does MaildirIndexer::Index; + +has %.mails; +has atomicint $!seen = 0; +has Int $.expect; +has $.seen-all; +has $!seen-all-vow; + +method set-expect(Int:D $!expect) { + $!seen ⚛= 0; + $!seen-all = Promise.new; + $!seen-all-vow = $!seen-all.vow; +} + +method add-mail(MaildirIndexer::Email:D $email, Str:D $mailbox --> Nil) { + %.mails{$mailbox}{$email.path}=1; + ++⚛$!seen; + if ($!seen == $!expect) { + $!seen-all-vow.keep(True) + } +} + +method del-path(IO:D $path, Str:D $mailbox --> Nil) { + %.mails{$mailbox}{$path}:delete; +} + +method mailbox-for-email(MaildirIndexer::Email:D $email --> Str) { + return 'foo' +} diff --git a/t/store.t b/t/store.t new file mode 100644 index 0000000..73903df --- /dev/null +++ b/t/store.t @@ -0,0 +1,33 @@ +#!perl6 +use v6.d; +use Test; +use lib 't/lib'; +use TestIndex; +use MaildirIndexer::Store; +use MaildirIndexer::Index; + +my Channel $file-channel .= new; +my TestIndex $index .= new; +my MaildirIndexer::Store $store .= new: :$file-channel, :indices($index), :2workers; + +$store.start(); + +$index.set-expect(4); +$file-channel.send("t/fixtures/$_".IO) for qw[one/cur/1 one/cur/2 two/cur/1 two/cur/2]; +await $index.seen-all; + +is-deeply( + $index.mails, + %( + one => %( 't/fixtures/one/cur/1' => 1, 't/fixtures/one/cur/2' => 1 ), + two => %( 't/fixtures/two/cur/1' => 1, 't/fixtures/two/cur/2' => 1 ), + ), + 'mails should be indexed', +); + +is( + $store.mailbox-for-email(MaildirIndexer::Email.new),'foo', + 'index is consulted', +); + +done-testing; -- cgit v1.2.3