this repo has no description
at trunk 59 lines 2.3 kB view raw
1// Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) 2#include <csignal> 3 4#include "handles.h" 5#include "runtime.h" 6 7using namespace py; 8 9int main(int argc, char* argv[]) { 10 Runtime runtime; 11 HandleScope scope; 12 13 // This file is used by test_lldb_support.py, both to create values to 14 // inspect in lldb and to provide the expected output of the printers in 15 // lldb_support.py. 16 // 17 // Comment lines beginning with either "// exp: " or "// re: " provide exact 18 // match or regex test patterns, respectively. The rest of the line is used 19 // as the pattern, and if it matches a full line anywhere in the output from 20 // lldb, that pattern passes. 21 // 22 // Note that this means that you could have the right output in the wrong 23 // place and still pass all tests. It's not perfect but it's simple and it 24 // gets the job done. 25 26 // clang-format off 27 28 // exp: (py::RawObject) imm1 = None 29 RawObject imm1 = NoneType::object(); 30 // exp: (py::Object) imm2 = Error 31 Object imm2(&scope, Error::object()); 32 // exp: (py::Object) imm3 = False 33 Object imm3(&scope, Bool::falseObj()); 34 // exp: (py::Object) imm4 = True 35 Object imm4(&scope, Bool::trueObj()); 36 // exp: (py::Object) imm5 = NotImplemented 37 Object imm5(&scope, NotImplementedType::object()); 38 // exp: (py::Object) imm6 = Unbound 39 Object imm6(&scope, Unbound::object()); 40 41 // exp: (py::RawSmallInt) int1 = 1234 42 RawSmallInt int1 = SmallInt::fromWord(1234); 43 // re: \(py::Int\) int2 = HeapObject @ 0x[0-9a-f]+ Header<kDataArray64, kLargeInt, hash=0, count=1> 44 Int int2(&scope, runtime.newInt(SmallInt::kMaxValue + 1)); 45 46 // exp: (py::RawObject) str1 = SmallStr('short') 47 RawObject str1 = SmallStr::fromCStr("short"); 48 // re: \(py::Str\) str2 = HeapObject @ 0x[0-9a-f]+ Header<kDataArray8, kLargeStr, hash=0, count=15> 49 Str str2(&scope, runtime.newStrFromCStr("a longer string")); 50 51 // re: \(py::RawObject\) heap1 = HeapObject @ 0x[0-9a-f]+ Header<kObjectArray, kTuple, hash=0, count=10> 52 RawObject heap1 = runtime.newTuple(10); 53 // re: \(py::HeapObject\) heap2 = HeapObject @ 0x[0-9a-f]+ Header<kObjectInstance, kList, hash=0, count=2> 54 HeapObject heap2(&scope, runtime.newList()); 55 56 // clang-format on 57 std::raise(SIGINT); 58 return 0; 59}