#
# Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0, which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# This Source Code may also be made available under the following Secondary
# Licenses when the conditions for such availability set forth in the
# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
# version 2 with the GNU Classpath Exception, which is available at
# https://www.gnu.org/software/classpath/license.html.
#
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
#

#
# Test data used by FoldTest.java to test the MimeUtility.fold
# and MimeUtility.unfold methods.
#
# First, tests that ensure simple strings aren't changed.
#
FOLD
a b c$
EXPECT
a b c$
UNFOLD
a b c$
EXPECT
a b c$
BOTH
a b c$
#
# Test that long strings with no whitespace aren't changed.
#
FOLD
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$
EXPECT
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$
UNFOLD
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$
EXPECT
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$
BOTH
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$
#
# Test simple folding of long strings.
#
BOTH
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaa$
FOLD
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaa$
EXPECT
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 aaaaaaaaaaaaaaaaaaaaa$
UNFOLD
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 aaaaaaaaaaaaaaaaaaaaa$
EXPECT
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaa$
UNFOLD
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 aaaaaaaaaaaaaaaaaaaaa$
EXPECT
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaa$
#
# Simple unfolding tests, with and without escaped newlines
#
UNFOLD
a
 b$
EXPECT
a b$
UNFOLD
a 
 b$
EXPECT
a  b$
#
UNFOLD
a \
 b$
EXPECT
a 
 b$
UNFOLD
a\
 b$
EXPECT
a
 b$
UNFOLD
a
 b$
EXPECT
a b$
UNFOLD
a 
 b$
EXPECT
a  b$
#
UNFOLD
a \
 b$
EXPECT
a 
 b$
UNFOLD
a\
 b$
EXPECT
a
 b$
UNFOLD
\
 a$
EXPECT

 a$
#
# Test with leading and trailing newlines
# XXX - Should trailing whitespace always be removed,
#	especially when it's the result of unfolding?
#
UNFOLD

 a$
EXPECT
 a$
UNFOLD

a$
EXPECT

a$
UNFOLD

 a$
EXPECT
 a$
UNFOLD

a$
EXPECT

a$
UNFOLD
a
$
EXPECT
a$
UNFOLD
a
 $
EXPECT
a $
#
# Test some boundary conditions for folding.
#
FOLD
aaaaaaaaaaaaaa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