testsuite: merge some lexer testcases
Now that the lexer is more robust, these tests don't need to be in separate files. Yay!
This commit is contained in:
parent
91357a9c4e
commit
c2dd553bed
src/test/compile-fail
lex-bad-char-literals.rslex-bad-fp-base-2.rslex-bad-fp-base-3.rslex-bad-fp-base-4.rslex-bad-fp-base-5.rslex-bad-fp-base-6.rslex-bad-fp-base-7.rslex-bad-fp-base-8.rslex-bad-fp-base-9.rslex-bad-fp-lit.rslex-bad-numeric-literals.rslex-bad-token.rslex-hex-float-lit.rslex-int-lit-too-large-2.rslex-int-lit-too-large.rslex-no-valid-digits-2.rslex-no-valid-digits.rslex-unknown-char-escape.rslex-unknown-start-tok.rslex-unknown-str-escape.rslex-unterminated-char-const.rs
@ -31,5 +31,19 @@ static s: &'static str =
|
||||
|
||||
static s2: &'static str =
|
||||
"\u23q" //~ ERROR: illegal character in numeric character escape
|
||||
//~^ ERROR: numeric character escape is too short
|
||||
;
|
||||
|
||||
static c: char =
|
||||
'\●' //~ ERROR: unknown character escape
|
||||
;
|
||||
|
||||
static s: &'static str =
|
||||
"\●" //~ ERROR: unknown character escape
|
||||
;
|
||||
|
||||
// THIS MUST BE LAST, since unterminated character constants kill the lexer
|
||||
|
||||
static c: char =
|
||||
'● //~ ERROR: unterminated character constant
|
||||
;
|
||||
//~^^ ERROR: numeric character escape is too short
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let b = 0o2f32; //~ ERROR: octal float literal is not supported
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let c = 0o3.0f32; //~ ERROR: octal float literal is not supported
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let d = 0o4e4; //~ ERROR: octal float literal is not supported
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let e = 0o5.0e5; //~ ERROR: octal float literal is not supported
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let f = 0o6e6f32; //~ ERROR: octal float literal is not supported
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let g = 0o7.0e7f64; //~ ERROR: octal float literal is not supported
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let h = 0x8.0e+9; //~ ERROR: hexadecimal float literal is not supported
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let i = 0x9.0e-9; //~ ERROR: hexadecimal float literal is not supported
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static f: float =
|
||||
1e+ //~ ERROR: scan_exponent: bad fp literal
|
||||
;
|
57
src/test/compile-fail/lex-bad-numeric-literals.rs
Normal file
57
src/test/compile-fail/lex-bad-numeric-literals.rs
Normal file
@ -0,0 +1,57 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
0o1.0; //~ ERROR: octal float literal is not supported
|
||||
0o2f32; //~ ERROR: octal float literal is not supported
|
||||
0o3.0f32; //~ ERROR: octal float literal is not supported
|
||||
0o4e4; //~ ERROR: octal float literal is not supported
|
||||
0o5.0e5; //~ ERROR: octal float literal is not supported
|
||||
0o6e6f32; //~ ERROR: octal float literal is not supported
|
||||
0o7.0e7f64; //~ ERROR: octal float literal is not supported
|
||||
0x8.0e+9; //~ ERROR: hexadecimal float literal is not supported
|
||||
0x9.0e-9; //~ ERROR: hexadecimal float literal is not supported
|
||||
}
|
||||
|
||||
static F: f32 =
|
||||
1e+ //~ ERROR: scan_exponent: bad fp literal
|
||||
;
|
||||
|
||||
|
||||
static F: f32 =
|
||||
0x539.0 //~ ERROR: hexadecimal float literal is not supported
|
||||
;
|
||||
|
||||
static I: int =
|
||||
99999999999999999999999999999999 //~ ERROR: int literal is too large
|
||||
;
|
||||
|
||||
static J: int =
|
||||
99999999999999999999999999999999u32 //~ ERROR: int literal is too large
|
||||
;
|
||||
|
||||
static A: int =
|
||||
0x //~ ERROR: no valid digits
|
||||
;
|
||||
static B: int =
|
||||
0xu32 //~ ERROR: no valid digits
|
||||
;
|
||||
static C: int =
|
||||
0ou32 //~ ERROR: no valid digits
|
||||
;
|
||||
static D: int =
|
||||
0bu32 //~ ERROR: no valid digits
|
||||
;
|
||||
static E: int =
|
||||
0b //~ ERROR: no valid digits
|
||||
;
|
||||
static F: int =
|
||||
0o //~ ERROR: no valid digits
|
||||
;
|
@ -8,6 +8,4 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let a = 0o1.0; //~ ERROR: octal float literal is not supported
|
||||
}
|
||||
● //~ ERROR: unknown start of token
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static f: float =
|
||||
0x539.0 //~ ERROR: hexadecimal float literal is not supported
|
||||
;
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static i: int =
|
||||
99999999999999999999999999999999u32 //~ ERROR: int literal is too large
|
||||
;
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static i: int =
|
||||
99999999999999999999999999999999 //~ ERROR: int literal is too large
|
||||
;
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static i: int =
|
||||
0xu32 //~ ERROR: no valid digits
|
||||
;
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static i: int =
|
||||
0x //~ ERROR: no valid digits
|
||||
;
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static c: char =
|
||||
'\●' //~ ERROR: unknown character escape
|
||||
;
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
● //~ ERROR: unknown start of token
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static s: &'static str =
|
||||
"\●" //~ ERROR: unknown character escape
|
||||
;
|
@ -1,13 +0,0 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static c: char =
|
||||
'● //~ ERROR: unterminated character constant
|
||||
;
|
Loading…
x
Reference in New Issue
Block a user