1 /* 2 * Copyright (c) 2014 Alex Crichton 3 * 4 * Permission is hereby granted, free of charge, to any 5 * person obtaining a copy of this software and associated 6 * documentation files (the "Software"), to deal in the 7 * Software without restriction, including without 8 * limitation the rights to use, copy, modify, merge, 9 * publish, distribute, sublicense, and/or sell copies of 10 * the Software, and to permit persons to whom the Software 11 * is furnished to do so, subject to the following 12 * conditions: 13 * 14 * The above copyright notice and this permission notice 15 * shall be included in all copies or substantial portions 16 * of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 19 * ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 20 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 21 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 22 * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 25 * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 26 * DEALINGS IN THE SOFTWARE. 27 */ 28 29 /* 30 * Copyright 2019 Joyent, Inc. 31 */ 32 33 /* 34 * Test cases taken from rustc-demangle 0.1.9 35 */ 36 37 #include "demangle_test.h" 38 39 /* BEGIN CSTYLED */ 40 41 GROUP(demangle, SYSDEM_LANG_RUST, 42 T_ERR("test"), 43 T("_ZN4testE", "test"), 44 T_ERR("_ZN4test"), 45 T("_ZN4test1a2bcE", "test::a::bc")); 46 47 GROUP(demangle_dollars, SYSDEM_LANG_RUST, 48 T("_ZN4$RP$E", ")"), 49 T("_ZN8$RF$testE", "&test"), 50 T("_ZN8$BP$test4foobE", "*test::foob"), 51 T("_ZN9$u20$test4foobE", " test::foob"), 52 T("_ZN35Bar$LT$$u5b$u32$u3b$$u20$4$u5d$$GT$E", "Bar<[u32; 4]>")); 53 54 GROUP(demangle_many_dollars, SYSDEM_LANG_RUST, 55 T("_ZN13test$u20$test4foobE", "test test::foob"), 56 T("_ZN12test$BP$test4foobE", "test*test::foob")); 57 58 GROUP(demangle_osx, SYSDEM_LANG_RUST, 59 T("__ZN5alloc9allocator6Layout9for_value17h02a996811f781011E", 60 "alloc::allocator::Layout::for_value::h02a996811f781011"), 61 T("__ZN38_$LT$core..option..Option$LT$T$GT$$GT$6unwrap18_MSG_FILE_LINE_COL17haf7cb8d5824ee659E", 62 "<core::option::Option<T>>::unwrap::_MSG_FILE_LINE_COL::haf7cb8d5824ee659"), 63 T("__ZN4core5slice89_$LT$impl$u20$core..iter..traits..IntoIterator$u20$for$u20$$RF$$u27$a$u20$$u5b$T$u5d$$GT$9into_iter17h450e234d27262170E", 64 "core::slice::<impl core::iter::traits::IntoIterator for &'a [T]>::into_iter::h450e234d27262170")); 65 66 GROUP(demangle_elements_beginning_with_underscore, SYSDEM_LANG_RUST, 67 T("_ZN13_$LT$test$GT$E", "<test>"), 68 T("_ZN28_$u7b$$u7b$closure$u7d$$u7d$E", "{{closure}}"), 69 T("_ZN15__STATIC_FMTSTRE", "__STATIC_FMTSTR")); 70 71 GROUP(demangle_trait_impls, SYSDEM_LANG_RUST, 72 T("_ZN71_$LT$Test$u20$$u2b$$u20$$u27$static$u20$as$u20$foo..Bar$LT$Test$GT$$GT$3barE", 73 "<Test + 'static as foo::Bar<Test>>::bar")); 74 75 GROUP(invalid_no_chop, SYSDEM_LANG_RUST, T_ERR("_ZNfooE")); 76 77 GROUP(handle_assoc_types, SYSDEM_LANG_RUST, 78 T("_ZN151_$LT$alloc..boxed..Box$LT$alloc..boxed..FnBox$LT$A$C$$u20$Output$u3d$R$GT$$u20$$u2b$$u20$$u27$a$GT$$u20$as$u20$core..ops..function..FnOnce$LT$A$GT$$GT$9call_once17h69e8f44b3723e1caE", 79 "<alloc::boxed::Box<alloc::boxed::FnBox<A, Output=R> + 'a> as core::ops::function::FnOnce<A>>::call_once::h69e8f44b3723e1ca")); 80 81 /* END CSTYLED */