Skip to content

Commit 0866ee5

Browse files
committed
Add unit tests for parser.
These tests were transferred from the parser tests from google/go-jsonnet Issue google#39
1 parent 334a225 commit 0866ee5

File tree

2 files changed

+433
-4
lines changed

2 files changed

+433
-4
lines changed

core/BUILD

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ package(default_visibility = ["//visibility:public"])
33
cc_library(
44
name = "common",
55
hdrs = [
6-
"unicode.h",
6+
"ast.h",
77
"static_error.h",
8+
"unicode.h",
89
],
910
includes = ["."],
1011
)
@@ -28,22 +29,38 @@ cc_test(
2829
],
2930
)
3031

32+
cc_library(
33+
name = "parser",
34+
srcs = ["parser.cpp"],
35+
hdrs = ["parser.h"],
36+
deps = [
37+
":common",
38+
":lexer",
39+
],
40+
)
41+
42+
cc_test(
43+
name = "parser_test",
44+
srcs = ["parser_test.cc"],
45+
deps = [
46+
":parser",
47+
"//external:gtest_main",
48+
],
49+
)
50+
3151
cc_library(
3252
name = "jsonnet-common",
3353
srcs = [
3454
"desugarer.cpp",
3555
"formatter.cpp",
3656
"libjsonnet.cpp",
37-
"parser.cpp",
3857
"static_analysis.cpp",
3958
"string_utils.cpp",
4059
"vm.cpp",
4160
],
4261
hdrs = [
43-
"ast.h",
4462
"desugarer.h",
4563
"formatter.h",
46-
"parser.h",
4764
"state.h",
4865
"static_analysis.h",
4966
"string_utils.h",
@@ -52,6 +69,7 @@ cc_library(
5269
deps = [
5370
":common",
5471
":lexer",
72+
":parser",
5573
"//include:libjsonnet",
5674
"//stdlib:std",
5775
],

0 commit comments

Comments
 (0)