You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by fa...@apache.org on 2007/12/19 16:35:59 UTC

svn commit: r605586 - /incubator/stdcxx/branches/4.2.x/tests/regress/21.string.io.stdcxx-250.cpp

Author: faridz
Date: Wed Dec 19 07:35:58 2007
New Revision: 605586

URL: http://svn.apache.org/viewvc?rev=605586&view=rev
Log:
2007-12-19 Farid Zaripov <fa...@epam.com>

	* 21.string.io.stdcxx-250.cpp: Regression test for STDCXX-250 issue.

Added:
    incubator/stdcxx/branches/4.2.x/tests/regress/21.string.io.stdcxx-250.cpp   (with props)

Added: incubator/stdcxx/branches/4.2.x/tests/regress/21.string.io.stdcxx-250.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/branches/4.2.x/tests/regress/21.string.io.stdcxx-250.cpp?rev=605586&view=auto
==============================================================================
--- incubator/stdcxx/branches/4.2.x/tests/regress/21.string.io.stdcxx-250.cpp (added)
+++ incubator/stdcxx/branches/4.2.x/tests/regress/21.string.io.stdcxx-250.cpp Wed Dec 19 07:35:58 2007
@@ -0,0 +1,54 @@
+/***********************************************************************
+ *
+ * 21.string.io.stdcxx-250.cpp - regression test for STDCXX-250
+ *
+ *   http://issues.apache.org/jira/browse/STDCXX-250
+ *
+ * $Id$
+ *
+ ***********************************************************************
+ *
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
+ *
+ ***********************************************************************/
+
+#include <cassert>
+#include <istream>
+#include <string>
+
+int main ()
+{
+    struct: std::streambuf {
+        int_type underflow () {
+            static int i = 0;
+            // i == 0: sgect() invoked from sentry ctor
+            // i == 1: sgetc() invoked from operator>>()
+            // i == 2: sbumpc() invoked from operator>>()
+            return 1 < i++ ? throw i : 'x';
+        }
+    } buf;
+
+    std::istream is (&buf);
+
+    std::string s;
+    is >> s;
+
+    assert ("x" == s);
+    assert ((is.failbit | is.badbit) == is.rdstate ());
+
+    return 0;
+}

Propchange: incubator/stdcxx/branches/4.2.x/tests/regress/21.string.io.stdcxx-250.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/stdcxx/branches/4.2.x/tests/regress/21.string.io.stdcxx-250.cpp
------------------------------------------------------------------------------
    svn:keywords = Id