From 34dc825066d9481152c4ef16cbc7e851b619bdae Mon Sep 17 00:00:00 2001 From: jangko Date: Wed, 13 Dec 2023 16:07:57 +0700 Subject: [PATCH] Add copyright year to source file --- config.nims | 9 +++++++++ json_serialization.nim | 9 +++++++++ json_serialization/format.nim | 9 +++++++++ json_serialization/lexer.nim | 9 ++++++++- json_serialization/reader.nim | 11 ++++++++++- json_serialization/std/net.nim | 9 +++++++++ json_serialization/std/options.nim | 9 +++++++++ json_serialization/std/sets.nim | 9 +++++++++ json_serialization/std/tables.nim | 9 +++++++++ json_serialization/stew/results.nim | 9 +++++++++ json_serialization/types.nim | 9 +++++++++ json_serialization/writer.nim | 12 ++++++++++++ tests/nim.cfg | 9 +++++++++ tests/test_all.nim | 11 +++++++++++ tests/test_json_flavor.nim | 9 +++++++++ tests/test_lexer.nim | 9 ++++++++- tests/test_serialization.nim | 11 ++++++++++- tests/utils.nim | 12 +++++++++++- 18 files changed, 169 insertions(+), 5 deletions(-) diff --git a/config.nims b/config.nims index 7c9db32..86bd4ef 100644 --- a/config.nims +++ b/config.nims @@ -1,3 +1,12 @@ +# json-serialization +# Copyright (c) 2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + # begin Nimble config (version 1) when fileExists("nimble.paths"): include "nimble.paths" diff --git a/json_serialization.nim b/json_serialization.nim index de62396..abde59a 100644 --- a/json_serialization.nim +++ b/json_serialization.nim @@ -1,3 +1,12 @@ +# json-serialization +# Copyright (c) 2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + import serialization, json_serialization/[format, reader, writer] diff --git a/json_serialization/format.nim b/json_serialization/format.nim index 0b44d9c..58e1ccc 100644 --- a/json_serialization/format.nim +++ b/json_serialization/format.nim @@ -1,3 +1,12 @@ +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + import serialization/formats diff --git a/json_serialization/lexer.nim b/json_serialization/lexer.nim index aee603d..b87efe1 100644 --- a/json_serialization/lexer.nim +++ b/json_serialization/lexer.nim @@ -1,4 +1,11 @@ -{.push raises: [].} +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. import std/[json, unicode], diff --git a/json_serialization/reader.nim b/json_serialization/reader.nim index 4e58e4a..5c51c61 100644 --- a/json_serialization/reader.nim +++ b/json_serialization/reader.nim @@ -1,3 +1,12 @@ +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + {.experimental: "notnil".} import @@ -773,4 +782,4 @@ template configureJsonDeserialization*( static: doAssert not allowNumericRepr or enumStyle(T) == EnumStyle.Numeric r.parseEnum(value, allowNumericRepr, stringNormalizer) -{.pop.} +{.pop.} \ No newline at end of file diff --git a/json_serialization/std/net.nim b/json_serialization/std/net.nim index 3ae93f4..16a00cd 100644 --- a/json_serialization/std/net.nim +++ b/json_serialization/std/net.nim @@ -1,3 +1,12 @@ +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + import std/strutils, stew/shims/net, ../../json_serialization, chronos/transports/common diff --git a/json_serialization/std/options.nim b/json_serialization/std/options.nim index 5dd9f24..d4a1300 100644 --- a/json_serialization/std/options.nim +++ b/json_serialization/std/options.nim @@ -1,3 +1,12 @@ +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + import std/options, ../../json_serialization/[reader, writer, lexer] export options diff --git a/json_serialization/std/sets.nim b/json_serialization/std/sets.nim index 96e50ce..a8c39b0 100644 --- a/json_serialization/std/sets.nim +++ b/json_serialization/std/sets.nim @@ -1,3 +1,12 @@ +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + import stew/shims/sets, ../../json_serialization/[reader, writer, lexer] export sets diff --git a/json_serialization/std/tables.nim b/json_serialization/std/tables.nim index d71e11b..aa461e6 100644 --- a/json_serialization/std/tables.nim +++ b/json_serialization/std/tables.nim @@ -1,3 +1,12 @@ +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + import stew/shims/tables, ../../json_serialization/[reader, writer, lexer] export tables diff --git a/json_serialization/stew/results.nim b/json_serialization/stew/results.nim index 0b0a18f..ea8f842 100644 --- a/json_serialization/stew/results.nim +++ b/json_serialization/stew/results.nim @@ -1,3 +1,12 @@ +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + import stew/results, ../../json_serialization/[reader, writer, lexer] diff --git a/json_serialization/types.nim b/json_serialization/types.nim index 5a366a5..639a5c2 100644 --- a/json_serialization/types.nim +++ b/json_serialization/types.nim @@ -1,3 +1,12 @@ +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + import serialization/errors diff --git a/json_serialization/writer.nim b/json_serialization/writer.nim index 9280809..dc80c58 100644 --- a/json_serialization/writer.nim +++ b/json_serialization/writer.nim @@ -1,3 +1,12 @@ +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + import std/[json, typetraits], faststreams/[outputs, textio], serialization, @@ -152,6 +161,9 @@ template writeObjectField*[FieldType, RecordType](w: var JsonWriter, field: FieldType): bool = mixin writeFieldIMPL, writeValue + type + R {.used.} = type record + w.writeFieldName(fieldName) when RecordType is tuple: w.writeValue(field) diff --git a/tests/nim.cfg b/tests/nim.cfg index 9d2b0c6..ab0ea36 100644 --- a/tests/nim.cfg +++ b/tests/nim.cfg @@ -1,2 +1,11 @@ +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + --threads:on diff --git a/tests/test_all.nim b/tests/test_all.nim index 01ba09b..fbd2c04 100644 --- a/tests/test_all.nim +++ b/tests/test_all.nim @@ -1,3 +1,14 @@ +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + +{. warning[UnusedImport]:off .} + import test_lexer, test_serialization diff --git a/tests/test_json_flavor.nim b/tests/test_json_flavor.nim index 46a44a6..8bd7a2a 100644 --- a/tests/test_json_flavor.nim +++ b/tests/test_json_flavor.nim @@ -1,3 +1,12 @@ +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + import strutils, serialization, diff --git a/tests/test_lexer.nim b/tests/test_lexer.nim index c0554d5..ec1642f 100644 --- a/tests/test_lexer.nim +++ b/tests/test_lexer.nim @@ -1,4 +1,11 @@ -{.used.} +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. import unittest, diff --git a/tests/test_serialization.nim b/tests/test_serialization.nim index 40c4e42..23cb5b3 100644 --- a/tests/test_serialization.nim +++ b/tests/test_serialization.nim @@ -1,4 +1,11 @@ -{.used.} +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. import strutils, unittest2, json, @@ -746,6 +753,7 @@ suite "toJson tests": expect SerializationError: let h4 = Json.decode("""{"o":{"distance":3,"x":1,"y":"2"}}""", HoldsOption, requireAllFields = true) + discard h4 test "Nested option types": let @@ -824,6 +832,7 @@ suite "toJson tests": expect SerializationError: let h4 = Json.decode("""{"o":{"distance":3,"x":1,"y":"2"}}""", HoldsResultOpt, requireAllFields = true) + discard h4 test "Custom field serialization": let obj = WithCustomFieldRule(str: "test", intVal: 10) diff --git a/tests/utils.nim b/tests/utils.nim index 3c19ef7..019c9ca 100644 --- a/tests/utils.nim +++ b/tests/utils.nim @@ -1,4 +1,14 @@ -import strutils +# json-serialization +# Copyright (c) 2019-2023 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) +# * MIT license ([LICENSE-MIT](LICENSE-MIT)) +# at your option. +# This file may not be copied, modified, or distributed except according to +# those terms. + +import + strutils # `dedent` exists in newer Nim version and doesn't behave the same func test_dedent*(s: string): string =