1# This file is part of GNU Mailutils. -*- Autotest -*-
2# Copyright (C) 2020-2021 Free Software Foundation, Inc.
3#
4# GNU Mailutils is free software; you can redistribute it and/or
5# modify it under the terms of the GNU General Public License as
6# published by the Free Software Foundation; either version 3, or (at
7# your option) any later version.
8#
9# GNU Mailutils is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12# General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.
16
17AT_SETUP([Reading message from stream])
18AT_KEYWORDS([readmesg])
19
20AT_DATA([input.mbox],
21[[From gray@example.net Sat Aug  1 10:53:43 2020
22Return-Path: <gray@example.net>
23Organization: Mailutils-tests
24Received: from example.net (localhost [127.0.0.1])
25	by example.net with ESMTP id g6G9BZb00791
26	for <gray@example.net>; Sat,  1 Aug 2020 13:53:43 +0300
27Message-Id: <200207160911.g6G9BZb00791@example.net>
28To: Bin <bin@example.org>
29Subject: Read from stream
30Date: Sat,  1 Aug 2020 13:53:43 +0300
31From: Sergey Poznyakoff <gray@example.net>
32
33This is a sample message.
34]])
35
36AT_DATA([input.mesg],
37[[Return-Path: <gray@example.net>
38Organization: Mailutils-tests
39Received: from example.net (localhost [127.0.0.1])
40	by example.net with ESMTP id g6G9BZb00791
41	for <gray@example.net>; Sat,  1 Aug 2020 13:53:43 +0300
42Message-Id: <200207160911.g6G9BZb00791@example.net>
43To: Bin <bin@example.org>
44Subject: Read from stream
45Date: Sat,  1 Aug 2020 13:53:43 +0300
46From: Sergey Poznyakoff <gray@example.net>
47
48This is a sample message.
49]])
50
51AT_DATA([expout],
52[Sender: gray@example.net
53Date: Sat Aug  1 10:53:43 2020
54Size: 425
55Lines: 12
56Headers: 8
57Header size: 399
58Header lines: 11
59Body size: 26
60Body lines: 1
61This is a sample message.
62])
63
64AT_CHECK([readmesg input.mbox],
65[0],
66[expout])
67
68AT_CHECK([readmesg input.mesg],
69[0],
70[expout])
71
72AT_CLEANUP