Skip to content

Commit 2db9adf

Browse files
committed
test(AnyJSON): add comprehensive and edge-case tests for AnyJSON
Covers value accessors, literal initializers, error handling, extensions, and edge cases to ensure full correctness and robustness.
1 parent 7de5b8b commit 2db9adf

File tree

4 files changed

+376
-42
lines changed

4 files changed

+376
-42
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
- { xcode: 15.2, command: test }
6868
- { xcode: 15.2, platform: MAC_CATALYST }
6969
- { xcode: 15.2, platform: TVOS }
70-
- { xcode: 15.2, platform: VISIONOS }
70+
#- { xcode: 15.2, platform: VISIONOS }
7171
- { xcode: 15.2, platform: WATCHOS }
7272
- { command: test, platform: WATCHOS }
7373
include:
@@ -186,4 +186,4 @@ jobs:
186186
steps:
187187
- uses: actions/checkout@v4
188188
- name: Test docs
189-
run: make test-docs
189+
run: make test-docs

Dockerfile

Lines changed: 0 additions & 15 deletions
This file was deleted.

Makefile

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,tvOS,TV)
1010
PLATFORM_VISIONOS = visionOS Simulator,id=$(call udid_for,visionOS,Vision)
1111
PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,watchOS,Watch)
1212

13-
1413
PLATFORM = IOS
1514
DESTINATION = platform="$(PLATFORM_$(PLATFORM))"
1615

16+
PLATFORM_ID = $(shell echo "$(DESTINATION)" | sed -E "s/.+,id=(.+)/\1/")
17+
1718
SCHEME = Supabase
1819

1920
WORKSPACE = Supabase.xcworkspace
@@ -26,19 +27,25 @@ XCODEBUILD_FLAGS = \
2627
-destination $(DESTINATION) \
2728
-scheme "$(SCHEME)" \
2829
-skipMacroValidation \
29-
-workspace $(WORKSPACE) \
30+
-workspace $(WORKSPACE)
3031

3132
XCODEBUILD_COMMAND = xcodebuild $(XCODEBUILD_ARGUMENT) $(XCODEBUILD_FLAGS)
3233

3334
ifneq ($(strip $(shell which xcbeautify)),)
34-
XCODEBUILD = set -o pipefail && $(XCODEBUILD_COMMAND) | xcbeautify --quiet
35+
XCODEBUILD = set -o pipefail && $(XCODEBUILD_COMMAND) | xcbeautify
3536
else
3637
XCODEBUILD = $(XCODEBUILD_COMMAND)
3738
endif
3839

3940
TEST_RUNNER_CI = $(CI)
4041

41-
xcodebuild:
42+
warm-simulator:
43+
@test "$(PLATFORM_ID)" != "" \
44+
&& xcrun simctl boot $(PLATFORM_ID) \
45+
&& open -a Simulator --args -CurrentDeviceUDID $(PLATFORM_ID) \
46+
|| exit 0
47+
48+
xcodebuild: warm-simulator
4249
$(XCODEBUILD)
4350

4451
test-integration:
@@ -48,6 +55,7 @@ test-integration:
4855

4956
build-for-library-evolution:
5057
swift build \
58+
-q \
5159
-c release \
5260
--target Supabase \
5361
-Xswiftc -emit-module-interface \
@@ -67,31 +75,18 @@ test-docs:
6775
&& exit 1)
6876

6977
format:
70-
@swift format -i -r --ignore-unparsable-files .
71-
72-
73-
test-linux:
74-
docker run \
75-
--rm \
76-
-v "$(PWD):$(PWD)" \
77-
-w "$(PWD)" \
78-
swift:5.10 \
79-
bash -c 'swift test -c $(CONFIG)'
80-
81-
build-linux:
82-
docker run \
83-
--rm \
84-
-v "$(PWD):$(PWD)" \
85-
-w "$(PWD)" \
86-
swift:5.9 \
87-
bash -c 'swift build -c $(CONFIG)'
78+
find . \
79+
-path '*/Documentation/docc' -prune -o \
80+
-name '*.swift' \
81+
-not -path '*/.*' -print0 \
82+
| xargs -0 xcrun swift-format --ignore-unparsable-files --in-place
8883

89-
.PHONY: build-for-library-evolution format xcodebuild test-docs test-integration
84+
.PHONY: build-for-library-evolution format warm-simulator xcodebuild test-docs test-integration
9085

9186
.PHONY: coverage
9287
coverage:
9388
@DERIVED_DATA_PATH=$(DERIVED_DATA_PATH) ./scripts/generate-coverage.sh
9489

9590
define udid_for
96-
$(shell xcrun simctl list devices available '$(1)' | grep '$(2)' | sort -r | head -1 | awk -F '[()]' '{ print $$(NF-3) }')
97-
endef
91+
$(shell xcrun simctl list --json devices available '$(1)' | jq -r '[.devices|to_entries|sort_by(.key)|reverse|.[].value|select(length > 0)|.[0]][0].udid')
92+
endef

0 commit comments

Comments
 (0)