Files
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
INPUTS
bindings
cmake
docs
examples
include
lib
runtime
tools
unittests
AST
ASTMatchers
Analysis
Basic
CodeGen
CrossTU
Driver
Format
Frontend
ASTUnitTest.cpp
CMakeLists.txt
CodeGenActionTest.cpp
CompilerInstanceTest.cpp
FrontendActionTest.cpp
PCHPreambleTest.cpp
ParsedSourceLocationTest.cpp
Lex
Rename
Rewrite
Sema
StaticAnalyzer
Tooling
libclang
CMakeLists.txt
utils
www
.arcconfig
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
INSTALL.txt
LICENSE.TXT
ModuleInfo.txt
NOTES.txt
README.txt
clang-tools-extra
compiler-rt
libcxx
libcxxabi
libunwind
lld
lldb
llvm
openmp
polly
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mk
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
linux-packaging-mono/external/llvm-project/clang/unittests/Frontend/ParsedSourceLocationTest.cpp

38 lines
1.3 KiB
C++
Raw Normal View History

//===- unittests/Frontend/ParsedSourceLocationTest.cpp - ------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "clang/Frontend/CommandLineSourceLoc.h"
#include "gtest/gtest.h"
using namespace llvm;
using namespace clang;
namespace {
TEST(ParsedSourceRange, ParseTest) {
auto Check = [](StringRef Value, StringRef Filename, unsigned BeginLine,
unsigned BeginColumn, unsigned EndLine, unsigned EndColumn) {
Optional<ParsedSourceRange> PSR = ParsedSourceRange::fromString(Value);
ASSERT_TRUE(PSR);
EXPECT_EQ(PSR->FileName, Filename);
EXPECT_EQ(PSR->Begin.first, BeginLine);
EXPECT_EQ(PSR->Begin.second, BeginColumn);
EXPECT_EQ(PSR->End.first, EndLine);
EXPECT_EQ(PSR->End.second, EndColumn);
};
Check("/Users/test/a-b.cpp:1:2", "/Users/test/a-b.cpp", 1, 2, 1, 2);
Check("/Users/test/a-b.cpp:1:2-3:4", "/Users/test/a-b.cpp", 1, 2, 3, 4);
Check("C:/Users/bob/a-b.cpp:1:2", "C:/Users/bob/a-b.cpp", 1, 2, 1, 2);
Check("C:/Users/bob/a-b.cpp:1:2-3:4", "C:/Users/bob/a-b.cpp", 1, 2, 3, 4);
}
} // anonymous namespace