Skip to content

Commit 476b3b7

Browse files
committed
---
yaml --- r: 144445 b: refs/heads/try2 c: c0aadfd h: refs/heads/master i: 144443: 28020a0 v: v3
1 parent 87a9365 commit 476b3b7

File tree

80 files changed

+2196
-673
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2196
-673
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 9d8897ba603b044a82a4cbcf97e5aadcb77ef661
8+
refs/heads/try2: c0aadfd76c33ccc26f5e1672243add2e2f73e923
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/tutorial.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2553,6 +2553,7 @@ tutorials on individual topics.
25532553
* [Macros][macros]
25542554
* [The foreign function interface][ffi]
25552555
* [Containers and iterators](tutorial-container.html)
2556+
* [Error-handling and Conditions](tutorial-conditions.html)
25562557

25572558
There is further documentation on the [wiki].
25582559

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env python
2+
# xfail-license
3+
# Copyright 2013 The Rust Project Developers. See the COPYRIGHT
4+
# file at the top-level directory of this distribution and at
5+
# http://rust-lang.org/COPYRIGHT.
6+
#
7+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10+
# option. This file may not be copied, modified, or distributed
11+
# except according to those terms.
12+
"""
13+
This script takes a list of keywords and generates a testcase, that checks
14+
if using the keyword as identifier fails, for every keyword. The generate
15+
test files are set read-only.
16+
Test for https://github.com/mozilla/rust/issues/2275
17+
18+
sample usage: src/etc/generate-keyword-tests.py as break
19+
"""
20+
21+
import sys
22+
import os
23+
import datetime
24+
import stat
25+
26+
27+
template = """// Copyright %d The Rust Project Developers. See the COPYRIGHT
28+
// file at the top-level directory of this distribution and at
29+
// http://rust-lang.org/COPYRIGHT.
30+
//
31+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
32+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
33+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
34+
// option. This file may not be copied, modified, or distributed
35+
// except according to those terms.
36+
37+
// This file was auto-generated using 'src/etc/generate-keyword-tests.py %s'
38+
39+
fn main() {
40+
let %s = "foo"; //~ error: ident
41+
}
42+
"""
43+
44+
test_dir = os.path.abspath(
45+
os.path.join(os.path.dirname(__file__), '../test/compile-fail')
46+
)
47+
48+
for kw in sys.argv[1:]:
49+
test_file = os.path.join(test_dir, 'keyword-%s-as-identifier.rs' % kw)
50+
51+
# set write permission if file exists, so it can be changed
52+
if os.path.exists(test_file):
53+
os.chmod(test_file, stat.S_IWUSR)
54+
55+
with open(test_file, 'wt') as f:
56+
f.write(template % (datetime.datetime.now().year, kw, kw))
57+
58+
# mark file read-only
59+
os.chmod(test_file, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH)

branches/try2/src/libextra/getopts.rs

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -689,9 +689,9 @@ pub mod groups {
689689
}
690690
}
691691

692-
// FIXME: #5516
692+
// FIXME: #5516 should be graphemes not codepoints
693693
// here we just need to indent the start of the description
694-
let rowlen = row.len();
694+
let rowlen = row.char_len();
695695
if rowlen < 24 {
696696
do (24 - rowlen).times {
697697
row.push_char(' ')
@@ -707,14 +707,14 @@ pub mod groups {
707707
desc_normalized_whitespace.push_char(' ');
708708
}
709709

710-
// FIXME: #5516
710+
// FIXME: #5516 should be graphemes not codepoints
711711
let mut desc_rows = ~[];
712712
do each_split_within(desc_normalized_whitespace, 54) |substr| {
713713
desc_rows.push(substr.to_owned());
714714
true
715715
};
716716

717-
// FIXME: #5516
717+
// FIXME: #5516 should be graphemes not codepoints
718718
// wrapped description
719719
row.push_str(desc_rows.connect(desc_sep));
720720

@@ -798,7 +798,7 @@ pub mod groups {
798798
cont
799799
};
800800

801-
ss.iter().enumerate().advance(|x| machine(x));
801+
ss.char_offset_iter().advance(|x| machine(x));
802802

803803
// Let the automaton 'run out' by supplying trailing whitespace
804804
while cont && match state { B | C => true, A => false } {
@@ -1580,4 +1580,31 @@ Options:
15801580
debug!("generated: <<%s>>", usage);
15811581
assert!(usage == expected)
15821582
}
1583+
1584+
#[test]
1585+
fn test_groups_usage_description_multibyte_handling() {
1586+
let optgroups = ~[
1587+
groups::optflag("k", "k\u2013w\u2013",
1588+
"The word kiwi is normally spelled with two i's"),
1589+
groups::optflag("a", "apple",
1590+
"This \u201Cdescription\u201D has some characters that could \
1591+
confuse the line wrapping; an apple costs 0.51€ in some parts of Europe."),
1592+
];
1593+
1594+
let expected =
1595+
~"Usage: fruits
1596+
1597+
Options:
1598+
-k --k–w– The word kiwi is normally spelled with two i's
1599+
-a --apple This “description” has some characters that could
1600+
confuse the line wrapping; an apple costs 0.51in
1601+
some parts of Europe.
1602+
";
1603+
1604+
let usage = groups::usage("Usage: fruits", optgroups);
1605+
1606+
debug!("expected: <<%s>>", expected);
1607+
debug!("generated: <<%s>>", usage);
1608+
assert!(usage == expected)
1609+
}
15831610
}

0 commit comments

Comments
 (0)