base_commit stringlengths 40 40 | patch stringlengths 274 342k | instance_id stringlengths 13 40 | pull_number int64 14 15.2k | hints_text stringlengths 0 37.4k | issue_numbers listlengths 1 3 | version stringlengths 3 5 | repo stringlengths 8 35 | created_at stringlengths 20 20 | test_patch stringlengths 308 274k | problem_statement stringlengths 25 44.3k | environment_setup_commit stringlengths 40 40 | FAIL_TO_PASS listlengths 1 1.1k | PASS_TO_PASS listlengths 0 7.38k | FAIL_TO_FAIL listlengths 0 1.72k | PASS_TO_FAIL listlengths 0 49 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4cb762ec8f24f8ef3e12fcd716326a1207a88018 | diff --git a/docs.md b/docs.md
--- a/docs.md
+++ b/docs.md
@@ -589,6 +589,13 @@ swift_name_macro = "CF_SWIFT_NAME"
# default: "None"
rename_args = "PascalCase"
+# This rule specifies if the order of functions will be sorted in some way.
+#
+# "Name": sort by the name of the function
+# "None": keep order in which t... | mozilla__cbindgen-466 | 466 | That is:
https://github.com/eqrion/cbindgen/blob/eb9cce693438d2cc6fe3d74eb5a56aa50094f68f/src/bindgen/library.rs#L58
So there's no way to workaround it at the moment. But it would be reasonable to add a config switch to avoid this. If you want to send a PR for that I'd be happy to review it :) | [
"461"
] | 0.12 | mozilla/cbindgen | 2020-01-26T12:45:53Z | diff --git /dev/null b/tests/expectations/both/function_sort_name.c
new file mode 100644
--- /dev/null
+++ b/tests/expectations/both/function_sort_name.c
@@ -0,0 +1,12 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+void A(void);
+
+void B(void);
+
+void C(void);
+
+void D(voi... | Keep order of exported functions
Hi,
In my project all `extern "C" pub fn`'s are declared in a single file / module.
Is it possible to ensure that the order of the generated exported functions in the header keeps same as in the module?
To me it seems that the functions are ordered by the functions name. Am I cor... | 4cb762ec8f24f8ef3e12fcd716326a1207a88018 | [
"test_function_sort_none"
] | [
"bindgen::mangle::generics",
"test_alias",
"test_asserted_cast",
"test_body",
"test_annotation",
"test_assoc_constant",
"test_docstyle_c99",
"test_cfg_2",
"test_documentation",
"test_const_conflict",
"test_cfg",
"test_char",
"test_cdecl",
"test_extern",
"test_const_transparent",
"test_... | [
"test_expand_default_features",
"test_expand",
"test_expand_dep",
"test_expand_dep_v2",
"test_expand_features",
"test_expand_no_default_features"
] | [] |
ff8e5d591dc8bf91a7309c54f0deb67899eeea87 | diff --git a/src/bindgen/utilities.rs b/src/bindgen/utilities.rs
--- a/src/bindgen/utilities.rs
+++ b/src/bindgen/utilities.rs
@@ -272,8 +272,7 @@ impl SynAttributeHelpers for [syn::Attribute] {
})) = attr.parse_meta()
{
if path.is_ident("doc") {
- ... | mozilla__cbindgen-454 | 454 | Yeah, it'd be great to get this fixed :)
After some researching I got some questions. Should I implement this translation by myself or using other crate?
One thing that bother me is that the spec of markdown line break is a bit vague. The algorithm isn't obvious to me. It might works for most cases but I'm afraid th... | [
"442"
] | 0.12 | mozilla/cbindgen | 2020-01-14T11:20:17Z | diff --git /dev/null b/tests/expectations/both/documentation_attr.c
new file mode 100644
--- /dev/null
+++ b/tests/expectations/both/documentation_attr.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+/**
+ *With doc attr, each attr contribute to one line of doc... | `doc` attribute doesn't behave like rustc does
Inputs
---
```rust
#[no_mangle]
#[doc = "a \n b"]
pub extern "C" fn example_a() {}
```
and
```rust
#[no_mangle]
#[doc = "a \n\n b"]
pub extern "C" fn example_b() {}
```
Rendered rustdoc
---
[rustdoc/the doc attribute](https://doc.rust-lang.org/rustdo... | 4cb762ec8f24f8ef3e12fcd716326a1207a88018 | [
"test_documentation_attr"
] | [
"bindgen::mangle::generics",
"test_custom_header",
"test_alias",
"test_display_list",
"test_dep_v2",
"test_derive_eq",
"test_cfg_field",
"test_docstyle_doxy",
"test_docstyle_c99",
"test_asserted_cast",
"test_associated_in_body",
"test_constant",
"test_body",
"test_cfg",
"test_char",
"t... | [
"test_expand",
"test_expand_default_features",
"test_expand_dep",
"test_expand_dep_v2",
"test_expand_features",
"test_expand_no_default_features"
] | [] |
5b4cda0d95690f00a1088f6b43726a197d03dad0 | diff --git a/src/bindgen/bindings.rs b/src/bindgen/bindings.rs
--- a/src/bindgen/bindings.rs
+++ b/src/bindgen/bindings.rs
@@ -2,10 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use std::cell::RefCell;
+use std::collec... | mozilla__cbindgen-401 | 401 | [
"397"
] | 0.9 | mozilla/cbindgen | 2019-10-12T13:18:55Z | diff --git a/tests/expectations/associated_in_body.cpp b/tests/expectations/associated_in_body.cpp
--- a/tests/expectations/associated_in_body.cpp
+++ b/tests/expectations/associated_in_body.cpp
@@ -32,11 +32,11 @@ struct StyleAlignFlags {
static const StyleAlignFlags END;
static const StyleAlignFlags FLEX_START;... | Initialize struct literals with list-initializer
On cbindgen 0.9.1, Values of bitflags are converted to static const items with designated initializer.
But designated initializer is not available in C++11. Sadly, It is available in C++20. https://en.cppreference.com/w/cpp/language/aggregate_initialization#Designated... | 5b4cda0d95690f00a1088f6b43726a197d03dad0 | [
"test_struct_literal_order"
] | [
"bindgen::mangle::generics",
"test_cdecl",
"test_bitflags",
"test_const_conflict",
"test_enum",
"test_annotation",
"test_asserted_cast",
"test_const_transparent",
"test_extern",
"test_assoc_const_conflict",
"test_array",
"test_documentation",
"test_custom_header",
"test_docstyle_doxy",
"... | [
"test_expand_features",
"test_expand_dep",
"test_expand_default_features",
"test_expand",
"test_expand_no_default_features"
] | [] | |
17d7aad7d07dce8aa665aedbc75c39953afe1600 | diff --git a/src/bindgen/parser.rs b/src/bindgen/parser.rs
--- a/src/bindgen/parser.rs
+++ b/src/bindgen/parser.rs
@@ -707,11 +707,22 @@ impl Parse {
return;
}
};
- if ty.is_none() {
- return;
- }
- let impl_path = ty.unwrap().get_root_path().unwr... | mozilla__cbindgen-494 | 494 | I can't can't tell whether this is the same thing or not because I can't read it, but I got: https://gist.githubusercontent.com/rainhead/cdc303c498a0d7389671942f6028a215/raw/1266d49996d41dd557987611272a3b97462906f3/cbindgen.txt
It works for me with `0.13.0`... What am I missing?
Looks like it works on master now.
Th... | [
"493"
] | 0.13 | mozilla/cbindgen | 2020-03-21T14:08:30Z | diff --git /dev/null b/tests/expectations/associated_constant_panic.c
new file mode 100644
--- /dev/null
+++ b/tests/expectations/associated_constant_panic.c
@@ -0,0 +1,4 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
diff --git /dev/null b/tests/expectations/associated_constant... | Panics with parse_deps=true
When running cbindgen in [this](https://github.com/RazrFalcon/ttf-parser/tree/master/c-api) dir with such config:
```toml
language = "C"
include_guard = "TTFP_H"
braces = "SameLine"
tab_width = 4
documentation_style = "doxy"
[defines]
"feature = logging" = "ENABLE_LOGGING"
[fn... | 6fd245096dcd5c50c1065b4bd6ce62a09df0b39b | [
"test_associated_constant_panic"
] | [
"bindgen::mangle::generics",
"test_assoc_const_conflict",
"test_cfg_field",
"test_char",
"test_cfg",
"test_cell",
"test_docstyle_doxy",
"test_docstyle_c99",
"test_bitflags",
"test_associated_in_body",
"test_destructor_and_copy_ctor",
"test_annotation",
"test_display_list",
"test_cfg_2",
... | [
"test_expand",
"test_expand_dep",
"test_expand_no_default_features",
"test_expand_default_features",
"test_expand_features",
"test_expand_dep_v2"
] | [] |
6654f99251769e9e037824d471f9f39e8d536b90 | diff --git a/src/bindgen/ir/ty.rs b/src/bindgen/ir/ty.rs
--- a/src/bindgen/ir/ty.rs
+++ b/src/bindgen/ir/ty.rs
@@ -392,6 +392,7 @@ impl Type {
// FIXME(#223): This is not quite correct.
"Option" if generic.is_repr_ptr() => Some(generic),
"NonNull" => Some(Type::Ptr(Box::new(generi... | mozilla__cbindgen-489 | 489 | Here's a reduced test-case:
```rust
pub struct NotReprC<T> { inner: T }
pub type Foo = NotReprC<std::cell::RefCell<i32>>;
#[no_mangle]
pub extern "C" fn root(node: &Foo) {}
```
I think instead we should forward-declare RefCell in this case. Right now cbindgen's output is:
```c++
#include <cstdarg>
#inc... | [
"488"
] | 0.13 | mozilla/cbindgen | 2020-03-09T00:29:19Z | diff --git /dev/null b/tests/expectations/both/cell.c
new file mode 100644
--- /dev/null
+++ b/tests/expectations/both/cell.c
@@ -0,0 +1,14 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;
+
+typedef NotReprC_RefCell_i32... | Create opaque type for a generic specialization with `RefCell` etc.
I have:
```rust
bundle.rs:
pub type Memoizer = RefCell<IntlLangMemoizer>;
pub type FluentBundle<R> = bundle::FluentBundleBase<R, Memoizer>;
ffi.rs:
type FluentBundleRc = FluentBundle<Rc<FluentResource>>;
#[no_mangle]
pub unsafe extern... | 6fd245096dcd5c50c1065b4bd6ce62a09df0b39b | [
"test_cell"
] | [
"bindgen::mangle::generics",
"test_constant",
"test_associated_in_body",
"test_alias",
"test_display_list",
"test_asserted_cast",
"test_array",
"test_cfg",
"test_assoc_const_conflict",
"test_const_conflict",
"test_annotation",
"test_cfg_2",
"test_docstyle_doxy",
"test_constant_constexpr",
... | [
"test_expand_dep",
"test_expand",
"test_expand_default_features",
"test_expand_dep_v2",
"test_expand_features",
"test_expand_no_default_features"
] | [] |
c3442809b9e0be814918de6281469a955acfe7df | diff --git a/src/bindgen/ir/enumeration.rs b/src/bindgen/ir/enumeration.rs
--- a/src/bindgen/ir/enumeration.rs
+++ b/src/bindgen/ir/enumeration.rs
@@ -17,6 +17,7 @@ use crate::bindgen::library::Library;
use crate::bindgen::mangle;
use crate::bindgen::monomorph::Monomorphs;
use crate::bindgen::rename::{IdentifierType... | mozilla__cbindgen-483 | 483 | Minimal rust file would be `#[repr(C, u8)] enum FluentValue { Double(f64), String(*const nsString) }`, or something of that sort.
I'd like to help this one :)
| [
"368"
] | 0.13 | mozilla/cbindgen | 2020-03-05T05:38:30Z | diff --git a/tests/expectations/both/reserved.c b/tests/expectations/both/reserved.c
--- a/tests/expectations/both/reserved.c
+++ b/tests/expectations/both/reserved.c
@@ -30,4 +30,48 @@ typedef struct C {
};
} C;
-void root(A a, B b, C c, int32_t namespace_, float float_);
+enum E_Tag {
+ Double,
+ Float,
+};
+... | Escape `Double`
```irc
> @emilio> gandalf: ah, `double` is a C++ keyword, use `Double_` and file a cbindgen issue to escape that?
```
| 6fd245096dcd5c50c1065b4bd6ce62a09df0b39b | [
"test_reserved"
] | [
"bindgen::mangle::generics",
"test_custom_header",
"test_const_transparent",
"test_documentation",
"test_char",
"test_array",
"test_const_conflict",
"test_associated_in_body",
"test_docstyle_doxy",
"test_asserted_cast",
"test_docstyle_c99",
"test_documentation_attr",
"test_display_list",
"... | [
"test_expand",
"test_expand_default_features",
"test_expand_dep_v2",
"test_expand_dep",
"test_expand_features",
"test_expand_no_default_features"
] | [] |
dfa6e5f9824aac416d267420f8730225011d5c8f | diff --git a/src/bindgen/ir/global.rs b/src/bindgen/ir/global.rs
--- a/src/bindgen/ir/global.rs
+++ b/src/bindgen/ir/global.rs
@@ -6,6 +6,7 @@ use std::io::Write;
use syn;
+use crate::bindgen::cdecl;
use crate::bindgen::config::Config;
use crate::bindgen::declarationtyperesolver::DeclarationTypeResolver;
use cr... | mozilla__cbindgen-479 | 479 | [
"476"
] | 0.13 | mozilla/cbindgen | 2020-02-25T05:38:43Z | diff --git /dev/null b/tests/expectations/both/global_variable.c
new file mode 100644
--- /dev/null
+++ b/tests/expectations/both/global_variable.c
@@ -0,0 +1,8 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+extern const char CONST_GLOBAL_ARRAY[128];
+
+extern char MUT_GLOBAL... | Wrong output for static arrays
```rust
#[no_mangle]
pub static mut MCRT_ERROR_TEXT: [c_char; 128] = [0; 128];
```
outputs this
```c
extern char[128] MCRT_ERROR_TEXT;
```
when it should be this:
```c
extern char MCRT_ERROR_TEXT[128];
```
| 6fd245096dcd5c50c1065b4bd6ce62a09df0b39b | [
"test_global_variable"
] | [
"bindgen::mangle::generics",
"test_cfg",
"test_custom_header",
"test_euclid",
"test_alias",
"test_constant",
"test_documentation",
"test_docstyle_auto",
"test_char",
"test_cdecl",
"test_assoc_constant",
"test_enum",
"test_destructor_and_copy_ctor",
"test_asserted_cast",
"test_const_confl... | [
"test_expand",
"test_expand_default_features",
"test_expand_dep",
"test_expand_dep_v2",
"test_expand_features",
"test_expand_no_default_features"
] | [] | |
6b4181540c146fff75efd500bfb75a2d60403b4c | diff --git a/src/bindgen/ir/generic_path.rs b/src/bindgen/ir/generic_path.rs
--- a/src/bindgen/ir/generic_path.rs
+++ b/src/bindgen/ir/generic_path.rs
@@ -27,18 +27,13 @@ impl GenericParams {
.collect(),
)
}
-}
-
-impl Deref for GenericParams {
- type Target = [Path];
-
- fn deref(&... | mozilla__cbindgen-563 | 563 | Heh, was just about to post a near-identical snippet to 206. CC'ing myself, mostly, but note that it doesn't have to be Result, explicitly. The following also breaks (but *not* without the `()` type parameter):
```
#[repr(C)]
pub struct CResultTempl<O, E> {
pub result_good: bool,
pub result: *const O,
pub er... | [
"527"
] | 0.14 | mozilla/cbindgen | 2020-08-14T20:16:40Z | diff --git /dev/null b/tests/expectations/both/opaque.c
new file mode 100644
--- /dev/null
+++ b/tests/expectations/both/opaque.c
@@ -0,0 +1,28 @@
+#ifdef __cplusplus
+// These could be added as opaque types I guess.
+template <typename T>
+struct BuildHasherDefault;
+
+struct DefaultHasher;
+#endif
+
+
+#include <stda... | panic: Result has 2 params but is being instantiated with 1 values
cbdingen version: `v0.14.2`
To reproduce the error, run `cbindgen --lang c --output test.h test.rs`, with the source of `test.rs` being:
```rust
use std::fmt;
// Result<(), T> seems to trip up cbindgen, here T=fmt::Error
// as it was how I ran ... | 6b4181540c146fff75efd500bfb75a2d60403b4c | [
"test_opaque"
] | [
"bindgen::mangle::generics",
"test_custom_header",
"test_cfg",
"test_constant_constexpr",
"test_cell",
"test_array",
"test_cdecl",
"test_const_transparent",
"test_constant_big",
"test_destructor_and_copy_ctor",
"test_docstyle_auto",
"test_assoc_const_conflict",
"test_docstyle_doxy",
"test_... | [
"test_expand_default_features",
"test_expand",
"test_expand_dep",
"test_expand_features",
"test_expand_dep_v2",
"test_expand_no_default_features"
] | [] |
6ba31b49f445290a4ac1d3141f2a783306b23a88 | diff --git a/src/bindgen/bitflags.rs b/src/bindgen/bitflags.rs
--- a/src/bindgen/bitflags.rs
+++ b/src/bindgen/bitflags.rs
@@ -43,7 +43,7 @@ impl Bitflags {
}
};
- let consts = flags.expand(name);
+ let consts = flags.expand(name, repr);
let impl_ = parse_quote! {
... | mozilla__cbindgen-556 | 556 | [
"555"
] | 0.14 | mozilla/cbindgen | 2020-07-30T14:25:00Z | diff --git a/tests/expectations/associated_in_body.c b/tests/expectations/associated_in_body.c
--- a/tests/expectations/associated_in_body.c
+++ b/tests/expectations/associated_in_body.c
@@ -14,22 +14,22 @@ typedef struct {
/**
* 'auto'
*/
-#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = 0 }
+#define Style... | Running cbindgen on a u32 bitflag with a 1<<31 entry produces C++ code that doesn't compile
Assuming you have a setup where `cargo +nightly test` passes everything, apply this patch:
```
diff --git a/tests/rust/bitflags.rs b/tests/rust/bitflags.rs
index 6c3fe4e..017104a 100644
--- a/tests/rust/bitflags.rs
+++ b/... | 6b4181540c146fff75efd500bfb75a2d60403b4c | [
"test_bitflags"
] | [
"bindgen::mangle::generics",
"test_array",
"test_constant",
"test_cfg_field",
"test_body",
"test_assoc_const_conflict",
"test_display_list",
"test_char",
"test_associated_constant_panic",
"test_alias",
"test_destructor_and_copy_ctor",
"test_cfg",
"test_cdecl",
"test_constant_big",
"test_... | [
"test_expand",
"test_expand_dep",
"test_expand_default_features",
"test_expand_dep_v2",
"test_expand_no_default_features",
"test_expand_features"
] | [] | |
92a5e28c084aefc101d2f71f236614d9fcaa1f9e | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1983,6 +1983,7 @@ impl Build {
if self.pic.unwrap_or(
!target.contains("windows")
&& !target.contains("-none-")
+ && !target.ends_with("-none")
... | rust-lang__cc-rs-1212 | 1,212 | [
"1211"
] | 1.1 | rust-lang/cc-rs | 2024-09-17T21:22:26Z | diff --git a/tests/test.rs b/tests/test.rs
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -269,6 +269,20 @@ fn gnu_x86_64_no_plt() {
test.cmd(0).must_have("-fno-plt");
}
+#[test]
+fn gnu_aarch64_none_no_pic() {
+ for target in &["aarch64-unknown-none-gnu", "aarch64-unknown-none"] {
+ let test = Test::gnu(... | Target strings that end in -none (such as aarch64-unknown-none) should not default to -fPIC
According to the [docs](https://docs.rs/cc/latest/cc/struct.Build.html#method.pic)
> This [pic] option defaults to false for windows-gnu and bare metal targets and to true for all other targets.
This means the bare metal targe... | 1d566d4287c428491d8037a561ae195c1bfc6f7a | [
"gnu_aarch64_none_no_pic"
] | [
"tests::test_android_clang_compiler_uses_target_arg_internally",
"main",
"gnu_no_warnings_if_cflags",
"gnu_test_parse_shell_escaped_flags",
"gnu_no_warnings_if_cxxflags",
"gnu_no_dash_dash",
"gnu_include",
"msvc_debug",
"gnu_opt_level_1",
"clang_android",
"gnu_define",
"gnu_set_stdlib",
"gnu... | [] | [] | |
eb3390615747fde57f7098797b2acb1aec80f539 | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,6 +21,7 @@ rust-version = "1.63"
[dependencies]
jobserver = { version = "0.1.30", default-features = false, optional = true }
+shlex = "1.3.0"
[target.'cfg(unix)'.dependencies]
# Don't turn on the feature "std" for this, see https://g... | rust-lang__cc-rs-1181 | 1,181 | While that might be possible to address in cc-rs, it still seems likely to break in other build systems, such as invocations of make, which don't have a solution to this problem.
@joshtriplett does `cc` forward to other build systems or only expand these flags into `argv` before invoking the compiler (which _should_ be... | [
"847"
] | 1.1 | rust-lang/cc-rs | 2024-08-12T01:19:17Z | diff --git /dev/null b/tests/cflags_shell_escaped.rs
new file mode 100644
--- /dev/null
+++ b/tests/cflags_shell_escaped.rs
@@ -0,0 +1,24 @@
+mod support;
+
+use crate::support::Test;
+use std::env;
+
+/// This test is in its own module because it modifies the environment and would affect other tests
+/// when run in p... | Encoded `CFLAGS` for supporting spaces
According to https://github.com/rust-lang/cc-rs/#external-configuration-via-environment-variables spaces nor escapes for spaces are not supported in e.g. `C(XX)FLAGS`. In [`xbuild`](https://github.com/rust-mobile/xbuild) we [use `CFLAGS` to set a `--sysroot` path](https://github.c... | 1d566d4287c428491d8037a561ae195c1bfc6f7a | [
"gnu_test_parse_shell_escaped_flags"
] | [
"tests::test_android_clang_compiler_uses_target_arg_internally",
"main",
"gnu_no_warnings_if_cflags",
"gnu_no_warnings_if_cxxflags",
"msvc_define",
"compile_intermediates",
"gnu_shared",
"gnu_opt_level_s",
"gnu_no_dash_dash",
"gnu_warnings",
"gnu_std_c",
"gnu_extra_warnings0",
"gnu_extra_war... | [] | [] |
4f312e3f3b2b4623e84518582a3ff17bbae70906 | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -261,6 +261,9 @@ mod tempfile;
mod utilities;
use utilities::*;
+mod flags;
+use flags::*;
+
#[derive(Debug, Eq, PartialEq, Hash)]
struct CompilerFlag {
compiler: Box<Path>,
diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/s... | rust-lang__cc-rs-1279 | 1,279 | Thanks, we definitely want more data to be fetcher from cargoz
Can you provide more details on what rustc/cargo flags it is?
The specific case I'm coming at this with is `-Z branch-protection`, e.g. `-Z branch-protection=pac-ret,bti`.
The corresponding cc flag would be `-mbranch-protection=pac-ret+bti`.
I imagine this... | [
"1254"
] | 1.2 | rust-lang/cc-rs | 2024-11-07T17:09:12Z | diff --git /dev/null b/src/flags.rs
new file mode 100644
--- /dev/null
+++ b/src/flags.rs
@@ -0,0 +1,482 @@
+use crate::target::TargetInfo;
+use crate::{Build, Error, ErrorKind, ToolFamily};
+use std::borrow::Cow;
+use std::ffi::OsString;
+use std::path::Path;
+
+#[derive(Debug, PartialEq, Default)]
+pub(crate) struct ... | Mechanism for automatically passing flags used by rustc
When cc-rs is running in a build script, it currently does not check which flags were passed to rustc.
There are some flags which in order to be fully effective need to be passed to both rustc and cc, a good example being AArch64 branch protection - if the Rust c... | 29d6ca194cca33f96071355764da436e21c34d12 | [
"inherits_rustflags"
] | [
"target::llvm::tests::test_basic_llvm_triple_guessing",
"target::tests::cannot_parse_extra",
"target::tests::tier1",
"tests::test_android_clang_compiler_uses_target_arg_internally",
"main",
"gnu_no_warnings_if_cflags",
"gnu_test_parse_shell_escaped_flags",
"gnu_no_warnings_if_cxxflags",
"gnu_compile... | [] | [] |
915420c16c134e6bb458ce634c663305a0ef2504 | diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1894,7 +1894,10 @@ impl Build {
// Target flags
match cmd.family {
ToolFamily::Clang => {
- if !(target.contains("android") && cmd.has_internal_target_arg) {
+ if !cmd.has_internal_tar... | rust-lang__cc-rs-991 | 991 | [
"990"
] | 1.0 | rust-lang/cc-rs | 2024-03-04T20:08:43Z | diff --git a/tests/test.rs b/tests/test.rs
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -617,3 +617,33 @@ fn compile_intermediates() {
assert!(intermediates[1].display().to_string().contains("x86_64"));
assert!(intermediates[2].display().to_string().contains("x86_64"));
}
+
+#[test]
+fn clang_android() {
+ ... | 1.0.88 breaks the Rust compile-ui tests for arm-android
When trying to update cc-rs to 1.0.88 in the Rust repo, we hit an error with the compile-ui test for arm-android:
<https://github.com/rust-lang/rust/pull/121854#issuecomment-1973518078>
```
2024-03-01T16:42:03.5816834Z ---- [ui] tests/ui/thread-local/tls.rs std... | 2a0bf2b0234a538f96a064bde2b50e6677b27c9c | [
"clang_android"
] | [
"test_android_clang_compiler_uses_target_arg_internally",
"main",
"gnu_no_warnings_if_cflags",
"gnu_no_warnings_if_cxxflags",
"msvc_define",
"msvc_debug",
"gnu_compile_assembly",
"gnu_extra_warnings1",
"compile_intermediates",
"gnu_extra_warnings0",
"gnu_warnings",
"gnu_debug_fp_auto",
"gnu_... | [] | [] | |
29d6ca194cca33f96071355764da436e21c34d12 | diff --git a/src/command_helpers.rs b/src/command_helpers.rs
--- a/src/command_helpers.rs
+++ b/src/command_helpers.rs
@@ -327,6 +327,9 @@ pub(crate) fn objects_from_files(files: &[Arc<Path>], dst: &Path) -> Result<Vec<
};
hasher.write(dirname.as_bytes());
+ if let Some(extension) = file.exte... | rust-lang__cc-rs-1295 | 1,295 | Yeah that's problematic. We could solve this two ways:
1. Add the extension to the hash.
2. Rewrite the whole thing to instead keep a `HashMap<OsString, NonZero<u32>>` for the compilation session, with each output file bumping a number in there.
- This would make absolutely sure we never leak information about abso... | [
"1294"
] | 1.2 | rust-lang/cc-rs | 2024-11-19T13:49:54Z | diff --git a/tests/test.rs b/tests/test.rs
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -27,7 +27,7 @@ fn gnu_smoke() {
.must_have("-ffunction-sections")
.must_have("-fdata-sections");
test.cmd(1)
- .must_have(test.td.path().join("d1fba762150c532c-foo.o"));
+ .must_have(test.td.path()... | Two source files with same name, different extension generate same object file name
Hi,
When building a project that has 2 sibling files with same name but different extension, they both result in the same filename for the object file. In my case:
```rs
...
.file("rv003usb.c")
.file("rv003usb.S")
```
produces two `rv0... | 29d6ca194cca33f96071355764da436e21c34d12 | [
"gnu_smoke",
"msvc_smoke"
] | [
"target::llvm::tests::test_basic_llvm_triple_guessing",
"target::tests::tier1",
"target::tests::cannot_parse_extra",
"tests::test_android_clang_compiler_uses_target_arg_internally",
"main",
"gnu_no_warnings_if_cflags",
"gnu_test_parse_shell_escaped_flags",
"gnu_no_warnings_if_cxxflags",
"clang_andro... | [] | [] |
e95b9dda33b40ce19dbad67a00c209b20bfab206 | diff --git a/src/ser.rs b/src/ser.rs
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -1,4 +1,5 @@
use std::fmt::Display;
+use std::fmt::Write as _;
use serde::ser;
diff --git a/src/ser.rs b/src/ser.rs
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -8,87 +9,83 @@ use crate::Config;
#[derive(Default, Debug)]
pub struct ConfigSerial... | rust-cli__config-rs-465 | 465 | [
"464"
] | 0.13 | rust-cli/config-rs | 2023-10-04T17:23:11Z | diff --git a/src/ser.rs b/src/ser.rs
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -717,4 +732,28 @@ mod test {
let actual: Test = config.try_deserialize().unwrap();
assert_eq!(test, actual);
}
+
+ #[test]
+ fn test_nest() {
+ let val = serde_json::json! { {
+ "top": {
+ ... | Nested arrays badly mangled
To reproduce:
```
#[test]
fn list() {
let jtxt = r#" { "proxy_ports": [ [1,2] ] } "#;
let jval: serde_json::Value = serde_json::from_str(jtxt).unwrap();
//dbg!(&jval);
let jcfg = config::Config::try_from(&jval).unwrap();
//dbg!(&jcfg);
... | c7ab1c3790f4314107bc5d69cd7486482b5f08dc | [
"ser::test::test_nest"
] | [
"path::parser::test::test_child",
"path::parser::test::test_id",
"path::parser::test::test_subscript",
"path::parser::test::test_subscript_neg",
"path::parser::test::test_id_dash",
"ser::test::test_struct",
"value::tests::test_i64",
"test_single_async_file_source",
"test_async_file_sources_with_over... | [] | [] | |
4896caf29a71174eeb6af884bba84bb99ca9bb87 | diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -17,6 +17,24 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
+[[package]]
+name = "ahash"
+version = "0.8.11"
+source = "regis... | rust-cli__config-rs-554 | 554 | more information here: https://github.com/rustsec/advisory-db/issues/1921
I have a PR open to switch to a different crate: https://github.com/mehcode/config-rs/pull/474
If anyone wants to pick up my work there that's appreciated, otherwise I plan to get my PRs for this project when I can spare the time. Presently I'... | [
"553"
] | 0.14 | rust-cli/config-rs | 2024-03-27T06:40:15Z | diff --git a/tests/file_yaml.rs b/tests/file_yaml.rs
--- a/tests/file_yaml.rs
+++ b/tests/file_yaml.rs
@@ -85,8 +85,7 @@ fn test_error_parse() {
assert_eq!(
res.unwrap_err().to_string(),
format!(
- "while parsing a block mapping, did not find expected key at \
- line 2 column 1... | cargo-audit reports that `yaml-rust` is unmaintained
We are using this crate in https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-vsock
We run `cargo-audit` in our CI which now is reporting that a dependency of this crate is unmaintained:
```
$ cargo audit
Fetching advisory database from `https:... | e3c1d0b452639478662a44f15ef6d5b6d969bf9b | [
"test_error_parse",
"legacy::file_yaml::test_error_parse"
] | [
"path::parser::test::test_id",
"path::parser::test::test_child",
"path::parser::test::test_id_dash",
"path::parser::test::test_subscript_neg",
"path::parser::test::test_subscript",
"ser::test::test_struct",
"value::tests::test_i64",
"ser::test::test_nest",
"test_single_async_file_source",
"test_as... | [] | [] |
20d37720b0342e68cd3c8c2c2a437b8634ec3642 | diff --git a/src/config.rs b/src/config.rs
--- a/src/config.rs
+++ b/src/config.rs
@@ -39,7 +39,7 @@ impl Default for ConfigKind {
/// A prioritized configuration repository. It maintains a set of
/// configuration sources, fetches values to populate those, and provides
/// them according to the source's priority.
-... | rust-cli__config-rs-184 | 184 | The automatic implementation of `Default` should be removed (I would move `::new` to a manual Default impl and delegate to the Default impl in new) and this should be fixed. Currently `Config::default()` can't be used if you want to rely on a `#[serde(default)]` annotation.
Sounds good. I think I can draft a PR. | [
"113"
] | 0.11 | rust-cli/config-rs | 2021-03-19T09:18:16Z | diff --git a/tests/defaults.rs b/tests/defaults.rs
--- a/tests/defaults.rs
+++ b/tests/defaults.rs
@@ -21,7 +21,7 @@ impl Default for Settings {
#[test]
fn set_defaults() {
- let c = Config::new();
+ let c = Config::default();
let s: Settings = c.try_into().expect("Deserialization failed");
assert... | Does `Config::new()` returns the same as `Config::default()`?
Does `Config::new()` returns (effectively) the same as `Config::default()`? If not, better to document how are they different. If so, should `Config::new()` just delegate to `Config::default()` in the implementation?
| bae775fc78b94ff5c9f29aeda4ade3baf3037a3d | [
"set_defaults",
"empty_deserializes"
] | [
"path::parser::test::test_child",
"path::parser::test::test_id",
"path::parser::test::test_id_dash",
"path::parser::test::test_subscript",
"path::parser::test::test_subscript_neg",
"ser::test::test_struct",
"test_datetime_string",
"test_datetime",
"try_from_defaults",
"test_default",
"test_prefi... | [] | [] |
8b41015dbb231a2e5e0be37698d49924a10b290f | diff --git a/src/de.rs b/src/de.rs
--- a/src/de.rs
+++ b/src/de.rs
@@ -62,25 +62,25 @@ impl<'de> de::Deserializer<'de> for Value {
#[inline]
fn deserialize_u8<V: de::Visitor<'de>>(self, visitor: V) -> Result<V::Value> {
// FIXME: This should *fail* if the value does not fit in the requets integer typ... | rust-cli__config-rs-353 | 353 | [
"352"
] | 0.13 | rust-cli/config-rs | 2022-06-28T13:32:34Z | diff --git a/tests/env.rs b/tests/env.rs
--- a/tests/env.rs
+++ b/tests/env.rs
@@ -130,6 +130,39 @@ fn test_parse_int() {
})
}
+#[test]
+fn test_parse_uint() {
+ // using a struct in an enum here to make serde use `deserialize_any`
+ #[derive(Deserialize, Debug)]
+ #[serde(tag = "tag")]
+ enum TestU... | Deserialization fails if set_default is passed an unsigned integer
Small motivating example that demonstrates the issue:
```rs
use config::{Config, Environment};
use serde::Deserialize;
use std::error::Error;
// Using any unsigned type here leads to a runtime deserialization error
// Runs fine when using i8, ... | c7ab1c3790f4314107bc5d69cd7486482b5f08dc | [
"test_parse_uint_default",
"invalid_signedness - should panic"
] | [
"path::parser::test::test_child",
"path::parser::test::test_id_dash",
"path::parser::test::test_subscript",
"path::parser::test::test_id",
"path::parser::test::test_subscript_neg",
"ser::test::test_struct",
"value::tests::test_i64",
"test_single_async_file_source",
"test_async_to_sync_file_sources",... | [] | [] | |
eec8d6d0cb7f65efa338d9b965788e887e28084f | diff --git a/src/error.rs b/src/error.rs
--- a/src/error.rs
+++ b/src/error.rs
@@ -174,7 +174,7 @@ impl ConfigError {
}
/// Alias for a `Result` with the error type set to `ConfigError`.
-pub(crate) type Result<T> = result::Result<T, ConfigError>;
+pub(crate) type Result<T, E = ConfigError> = result::Result<T, E>;
... | rust-cli__config-rs-620 | 620 | [
"619"
] | 1.75 | rust-cli/config-rs | 2024-12-19T15:36:48Z | diff --git a/tests/testsuite/errors.rs b/tests/testsuite/errors.rs
--- a/tests/testsuite/errors.rs
+++ b/tests/testsuite/errors.rs
@@ -3,6 +3,52 @@ use snapbox::{assert_data_eq, str};
use config::{Config, ConfigError, File, FileFormat, Map, Value};
+#[test]
+#[cfg(feature = "json")]
+fn test_error_path_index_bound... | panic on negative out-of-bounds array path expressions
The following program panics
```rust
// panics(release) with message: 'index out of bounds: the len is 0 but the index is 18446744073709551615'
// panics(debug) with message: 'attempt to subtract with overflow'
fn main() {
let _cfg = config::Config::builde... | eec8d6d0cb7f65efa338d9b965788e887e28084f | [
"errors::test_error_path_index_negative_bounds",
"set::test_set_arr_path"
] | [
"path::parser::test::test_id_dash",
"path::parser::test::test_child",
"path::parser::test::test_id",
"path::parser::test::test_subscript",
"path::parser::test::test_subscript_neg",
"ser::test::test_struct",
"value::tests::test_i64",
"ser::test::test_nest",
"async_builder::test_single_async_file_sour... | [] | [] | |
2ded3480894a82a93d6e4d46c73676b50b76ff24 | diff --git a/src/ser.rs b/src/ser.rs
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -1,4 +1,5 @@
use std::fmt::Display;
+use std::fmt::Write as _;
use serde::ser;
diff --git a/src/ser.rs b/src/ser.rs
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -8,87 +9,83 @@ use crate::Config;
#[derive(Default, Debug)]
pub struct ConfigSerial... | rust-cli__config-rs-486 | 486 | [
"464"
] | 0.13 | rust-cli/config-rs | 2023-10-23T16:38:33Z | diff --git a/src/ser.rs b/src/ser.rs
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -717,4 +732,28 @@ mod test {
let actual: Test = config.try_deserialize().unwrap();
assert_eq!(test, actual);
}
+
+ #[test]
+ fn test_nest() {
+ let val = serde_json::json! { {
+ "top": {
+ ... | Nested arrays badly mangled
To reproduce:
```
#[test]
fn list() {
let jtxt = r#" { "proxy_ports": [ [1,2] ] } "#;
let jval: serde_json::Value = serde_json::from_str(jtxt).unwrap();
//dbg!(&jval);
let jcfg = config::Config::try_from(&jval).unwrap();
//dbg!(&jcfg);
... | c7ab1c3790f4314107bc5d69cd7486482b5f08dc | [
"ser::test::test_nest"
] | [
"path::parser::test::test_id",
"path::parser::test::test_child",
"path::parser::test::test_id_dash",
"path::parser::test::test_subscript_neg",
"path::parser::test::test_subscript",
"ser::test::test_struct",
"value::tests::test_i64",
"test_single_async_file_source",
"test_async_file_sources_with_over... | [] | [] | |
ad29f8f83566366671e6affd3887079d7165f5f9 | diff --git a/src/de.rs b/src/de.rs
--- a/src/de.rs
+++ b/src/de.rs
@@ -215,7 +215,7 @@ impl<'de> de::MapAccess<'de> for MapAccess {
K: de::DeserializeSeed<'de>,
{
if let Some(&(ref key_s, _)) = self.elements.front() {
- let key_de = StrDeserializer(key_s);
+ let key_de = Val... | rust-cli__config-rs-119 | 119 | It just seems that we don't support it on our end probably due to oversight. This would be a bug that needs fixing.
I've hit this too and tried to report it to serde (because to me it looked like the generated Deserialize must have been wrong).
Anyway, I also have a workaround, look [here](https://github.com/serde-... | [
"74"
] | 0.9 | rust-cli/config-rs | 2019-08-23T07:12:03Z | diff --git a/tests/Settings.toml b/tests/Settings.toml
--- a/tests/Settings.toml
+++ b/tests/Settings.toml
@@ -9,6 +9,7 @@ code = 53
boolean_s_parse = "fals"
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
+quarks = ["up", "down", "strange", "charm", "bottom", "top"]
[diodes]
green = "off"
diff --git a/tests/Settings.tom... | Support Enum?
Got this error when try it with config-rs:
```
Err(invalid type: string "master", expected enum Mode)
```
Below is the struct and toml file:
```
#[derive(Debug, Deserialize)]
struct Database {
url: String,
mode: Mode,
}
#[derive(Debug, Deserialize)]
enum Mode {
Master,
Sl... | ad29f8f83566366671e6affd3887079d7165f5f9 | [
"test_int_key",
"test_enum_key"
] | [
"path::parser::test::test_child",
"path::parser::test::test_id",
"path::parser::test::test_subscript",
"ser::test::test_struct",
"path::parser::test::test_subscript_neg",
"path::parser::test::test_id_dash",
"test_datetime_string",
"test_datetime",
"set_defaults",
"try_from_defaults",
"empty_dese... | [] | [] |
db19a77e8eb00ca813e093c99093906e47b12296 | diff --git a/src/docker/provided_images.rs b/src/docker/provided_images.rs
--- a/src/docker/provided_images.rs
+++ b/src/docker/provided_images.rs
@@ -78,16 +78,6 @@ pub static PROVIDED_IMAGES: &[ProvidedImage] = &[
platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
sub: None
},
-... | cross-rs__cross-1432 | 1,432 | [
"1425"
] | 0.2 | cross-rs/cross | 2024-02-01T20:55:10Z | diff --git a/ci/test-zig-image.sh b/ci/test-zig-image.sh
--- a/ci/test-zig-image.sh
+++ b/ci/test-zig-image.sh
@@ -16,8 +16,9 @@ ci_dir=$(realpath "${ci_dir}")
TARGETS=(
"aarch64-unknown-linux-gnu"
"aarch64-unknown-linux-musl"
- "i586-unknown-linux-gnu"
- "i586-unknown-linux-musl"
+ # disabled, see ... | Fix zig image
[zig](https://github.com/cross-rs/cross/actions/runs/7703230077/job/20993312365) - ❌
```
Running `/target/debug/build/hellopp-4198e14c1842cfb5/build-script-build`
The following warnings were emitted during compilation:
warning: hellopp@0.1.0: error: unsupported linker arg: -melf_i386
error... | d8631fe4f4e8bb4c4b24417a35544857fb42ee22 | [
"codegen::ensure_correct_codegen"
] | [
"changelog::tests::change_log_type_from_header",
"changelog::tests::changelog_contents_deserialize",
"changelog::tests::changelog_type_sort",
"changelog::tests::changelog_entry_display",
"changelog::tests::test_id_type_parse_changelog",
"changelog::tests::test_id_type_parse_stem",
"ci::target_matrix::te... | [] | [] | |
7b2c645a1a076646cedb10f1a8b0e53b20bd4a9d | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -38,6 +38,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
+- #781 - ensure `target.$(...)` config options override `build` ones.
- #771 - fix parsing of `DOCKER_OPTS`.
- #727 - add `PKG_CONFIG_PATH... | cross-rs__cross-781 | 781 | [
"773"
] | 0.2 | cross-rs/cross | 2022-06-11T02:15:12Z | diff --git a/src/config.rs b/src/config.rs
--- a/src/config.rs
+++ b/src/config.rs
@@ -360,7 +360,7 @@ mod tests {
map.insert("CROSS_TARGET_AARCH64_UNKNOWN_LINUX_GNU_XARGO", "true");
let env = Environment::new(Some(map));
let config = Config::new_with(Some(toml(TOML_BUILD_XARGO_FA... | Incorrect Environment Variable/Config Logic
### Checklist
- [X] I've looked through the [issues and pull requests](https://github.com/cross-rs/cross/issues?q=) for similar reports
### Describe your issue
The code for parsing some environment variable logic (for example, `xargo`) is as follows:
```rust
pub fn... | d8631fe4f4e8bb4c4b24417a35544857fb42ee22 | [
"config::tests::test_config::env_target_and_toml_build_xargo_then_use_toml"
] | [
"config::tests::test_config::env_and_toml_build_xargo_then_use_env",
"config::tests::test_config::env_and_toml_default_target_then_use_env",
"config::tests::test_config::no_env_and_no_toml_default_target_then_none",
"config::tests::test_config::no_env_but_toml_default_target_then_use_toml",
"config::tests::... | [] | [] | |
1d9d31080c641d37d5213992f12a557d8e47664e | diff --git /dev/null b/.changes/1183.json
new file mode 100644
--- /dev/null
+++ b/.changes/1183.json
@@ -0,0 +1,5 @@
+{
+ "description": "resolve issue when using `pre-build` and `image.toolchain` in `Cargo.toml`",
+ "type": "fixed",
+ "issues": [1182]
+}
diff --git a/src/docker/custom.rs b/src/docker/custom.... | cross-rs__cross-1183 | 1,183 | This should work in `Cargo.toml`, the issue is how we're doing the deserialization
https://github.com/cross-rs/cross/blob/1d9d31080c641d37d5213992f12a557d8e47664e/src/cross_toml.rs#L177
and https://github.com/cross-rs/cross/blob/1d9d31080c641d37d5213992f12a557d8e47664e/src/docker/image.rs#L108-L108
Alright, that ... | [
"1182"
] | 0.2 | cross-rs/cross | 2023-01-06T02:55:04Z | diff --git a/src/cross_toml.rs b/src/cross_toml.rs
--- a/src/cross_toml.rs
+++ b/src/cross_toml.rs
@@ -855,6 +855,29 @@ mod tests {
Ok(())
}
+ #[test]
+ pub fn fully_populated_roundtrip() -> Result<()> {
+ let cfg = r#"
+ [target.a]
+ xargo = false
+ build-s... | Config in Cargo.toml: invalid type: map, expected a string for key `target.x86_64-unknown-freebsd.image`
### Checklist
- [X] I've looked through the [issues and pull requests](https://github.com/cross-rs/cross/issues?q=) for similar reports
### Describe your issue
Related: https://github.com/cross-rs/cross/iss... | d8631fe4f4e8bb4c4b24417a35544857fb42ee22 | [
"tests::toml::toml_check",
"cross_toml::tests::fully_populated_roundtrip"
] | [
"cli::tests::is_verbose_test",
"config::tests::test_config::env_target_and_toml_build_xargo_then_use_toml",
"config::tests::test_config::env_target_and_toml_target_xargo_target_then_use_env",
"config::tests::test_config::env_and_toml_default_target_then_use_env",
"config::tests::test_config::toml_build_pass... | [] | [] |
f059d1a924deac59aacc4a3560a91e52ce32164e | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased] - ReleaseDate
+### Added
+
+- #890 - support rootless docker via the `CROSS_ROOTLESS_CONTAINER_ENGINE` environment variable.
+
### Chan... | cross-rs__cross-890 | 890 | [
"889"
] | 0.2 | cross-rs/cross | 2022-07-01T04:45:06Z | diff --git a/src/docker/shared.rs b/src/docker/shared.rs
--- a/src/docker/shared.rs
+++ b/src/docker/shared.rs
@@ -648,6 +657,50 @@ pub fn path_hash(path: &Path) -> Result<String> {
#[cfg(test)]
mod tests {
use super::*;
+ use crate::id;
+
+ #[test]
+ fn test_docker_user_id() {
+ let var = "CROSS... | Support Rootless Docker
### Checklist
- [X] I've looked through the [issues and pull requests](https://github.com/cross-rs/cross/issues?q=) for similar request
- [ ] This feature could be solved with a [custom docker image](https://github.com/cross-rs/cross#custom-docker-images) (optional)
### Describe your requ... | d8631fe4f4e8bb4c4b24417a35544857fb42ee22 | [
"docker::shared::tests::test_docker_user_id"
] | [
"config::tests::test_config::env_and_toml_default_target_then_use_env",
"config::tests::test_config::env_target_and_toml_build_xargo_then_use_toml",
"config::tests::test_config::no_env_and_no_toml_default_target_then_none",
"config::tests::test_config::env_and_toml_build_xargo_then_use_env",
"config::tests:... | [] | [] | |
7c06ad9f8b195d2a1867b176bf9335721f3186cd | diff --git a/xtask/src/util.rs b/xtask/src/util.rs
--- a/xtask/src/util.rs
+++ b/xtask/src/util.rs
@@ -165,17 +165,23 @@ impl std::str::FromStr for ImageTarget {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
- if let Some((target, sub)) = s.split_once('.') {
-... | cross-rs__cross-1022 | 1,022 | [
"1020"
] | 0.2 | cross-rs/cross | 2022-09-12T17:54:54Z | diff --git a/xtask/src/util.rs b/xtask/src/util.rs
--- a/xtask/src/util.rs
+++ b/xtask/src/util.rs
@@ -270,6 +276,40 @@ mod tests {
use cross::shell::Verbosity;
use std::collections::BTreeMap;
+ #[test]
+ fn test_parse_image_target() {
+ assert_eq!(
+ ImageTarget {
+ n... | Future-Proofing Images with Subs
Rust triples are allowed to contain `.` characters, although I believe this is limited only to the architecture portion of the triple (and not the OS, vendor, or environment). For example, `thumbv8m.main-none-eabihf` is a valid LLVM triple. This means that splitting on a `.` character i... | d8631fe4f4e8bb4c4b24417a35544857fb42ee22 | [
"util::tests::test_parse_image_target"
] | [
"changelog::tests::change_log_type_from_header",
"changelog::tests::changelog_type_sort",
"changelog::tests::changelog_entry_display",
"changelog::tests::changelog_contents_deserialize",
"changelog::tests::test_id_type_parse_changelog",
"changelog::tests::test_id_type_parse_stem",
"changelog::tests::rea... | [] | [] | |
f7063d9160671ab3be4b4add8d19271abb022cbd | diff --git a/src/event.rs b/src/event.rs
--- a/src/event.rs
+++ b/src/event.rs
@@ -73,6 +73,7 @@
//! them (`event-*`).
use std::fmt;
+use std::hash::{Hash, Hasher};
use std::time::Duration;
use bitflags::bitflags;
diff --git a/src/event.rs b/src/event.rs
--- a/src/event.rs
+++ b/src/event.rs
@@ -385,7 +386,7 @@... | crossterm-rs__crossterm-541 | 541 | [
"517"
] | 0.19 | crossterm-rs/crossterm | 2021-02-20T17:23:01Z | diff --git a/src/event.rs b/src/event.rs
--- a/src/event.rs
+++ b/src/event.rs
@@ -466,3 +508,41 @@ pub(crate) enum InternalEvent {
#[cfg(unix)]
CursorPosition(u16, u16),
}
+
+#[cfg(test)]
+mod tests {
+ use std::collections::hash_map::DefaultHasher;
+ use std::hash::{Hash, Hasher};
+
+ use super::{... | KeyEvent's KeyCode's case could be normalized to be less redundant
**Is your feature request related to a problem? Please describe.**
It is a little frustrating when comparing something like
```
KeyEvent { KeyCode::Char('a'), KeyModifiers::SHIFT } == KeyEvent { KeyCode::Char('A'), KeyModifiers::SHIFT }
```
and ge... | f7063d9160671ab3be4b4add8d19271abb022cbd | [
"event::tests::test_equality",
"event::tests::test_hash"
] | [
"event::filter::tests::test_cursor_position_filter_filters_cursor_position",
"event::filter::tests::test_event_filter_filters_events",
"event::filter::tests::test_event_filter_filters_internal_events",
"event::read::tests::test_poll_continues_after_error",
"event::read::tests::test_poll_fails_without_event_... | [] | [] | |
128eddeafcea5194d529c4788ecd4afeb16eaf01 | diff --git a/src/event/sys/unix/parse.rs b/src/event/sys/unix/parse.rs
--- a/src/event/sys/unix/parse.rs
+++ b/src/event/sys/unix/parse.rs
@@ -95,13 +95,22 @@ pub(crate) fn parse_event(buffer: &[u8], input_available: bool) -> Result<Option
_ => parse_utf8_char(buffer).map(|maybe_char| {
maybe_char... | crossterm-rs__crossterm-423 | 423 | [
"421"
] | 0.17 | crossterm-rs/crossterm | 2020-04-22T09:41:11Z | diff --git a/src/event/sys/unix/parse.rs b/src/event/sys/unix/parse.rs
--- a/src/event/sys/unix/parse.rs
+++ b/src/event/sys/unix/parse.rs
@@ -553,7 +562,10 @@ mod tests {
// parse_utf8_char
assert_eq!(
parse_event("Ž".as_bytes(), false).unwrap(),
- Some(InternalEvent::Event(Ev... | KeyEvent modifier inconsistent for capital letters
**Describe the bug**
As discussed in the Discord: I observed that on *nix platforms the KeyEvent of a capital letter does not contain the Shift modifier and on Windows it does.
**To Reproduce**
run the example `event-poll-read` and press a capital letter (e.g Sh... | 128eddeafcea5194d529c4788ecd4afeb16eaf01 | [
"event::sys::unix::parse::tests::test_parse_char_event_uppercase",
"event::sys::unix::parse::tests::test_parse_event_subsequent_calls"
] | [
"event::filter::tests::test_cursor_position_filter_filters_cursor_position",
"event::filter::tests::test_event_filter_filters_events",
"event::filter::tests::test_event_filter_filters_internal_events",
"event::read::tests::test_poll_continues_after_error",
"event::read::tests::test_poll_fails_without_event_... | [] | [] | |
fce58c879a748f3159216f68833100aa16141ab0 | diff --git a/src/style.rs b/src/style.rs
--- a/src/style.rs
+++ b/src/style.rs
@@ -161,9 +161,23 @@ pub fn style<D: Display>(val: D) -> StyledContent<D> {
///
/// This does not always provide a good result.
pub fn available_color_count() -> u16 {
- env::var("TERM")
- .map(|x| if x.contains("256color") { 25... | crossterm-rs__crossterm-885 | 885 | For that matter, just checking `TERM` is not sufficient on any platform. See helper functions used by the cli/go-ch link above: <https://github.com/cli/go-gh/blob/dbd982eba2a041d88d398cce01cb708c4c3503f7/pkg/term/env.go#L170-L184>. | [
"882"
] | 0.27 | crossterm-rs/crossterm | 2024-05-04T16:30:14Z | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -89,6 +89,7 @@ futures-timer = "3.0"
async-std = "1.12"
serde_json = "1.0"
serial_test = "2.0.0"
+temp-env = "0.3.6"
#
# Examples
diff --git a/src/style.rs b/src/style.rs
--- a/src/style.rs
+++ b/src/style.rs
@@ -519,3 +533,89 @@ impl_disp... | available_color_count is wrong on Windows
**Describe the bug**
Windows pseudo-TTYs support true color, yes `crossterm::style::available_color_count` reports 8. You need to query if you're in a pseudo-terminal which, BTW, means you can do just about any VT100 sequence including keyboard support, though I'm not sure wha... | fce58c879a748f3159216f68833100aa16141ab0 | [
"style::tests::colorterm_overrides_term",
"style::tests::term_24bits"
] | [
"event::filter::tests::test_cursor_position_filter_filters_cursor_position",
"event::filter::tests::test_event_filter_filters_internal_events",
"event::filter::tests::test_event_filter_filters_events",
"event::filter::tests::test_keyboard_enhancement_status_filter_filters_keyboard_enhancement_status",
"even... | [] | [] |
13213b7a85cc1b5dcac0848bb664f34d463ac7e7 | diff --git a/gen/cmd/src/app.rs b/gen/cmd/src/app.rs
--- a/gen/cmd/src/app.rs
+++ b/gen/cmd/src/app.rs
@@ -65,18 +65,25 @@ pub(super) fn from_args() -> Opt {
.unwrap_or_default()
.map(str::to_owned)
.collect();
- let output = match matches.value_of_os(OUTPUT) {
- None => Output::Std... | dtolnay__cxx-319 | 319 | [
"64"
] | 0.4 | dtolnay/cxx | 2020-09-24T15:35:19Z | diff --git a/gen/cmd/src/test.rs b/gen/cmd/src/test.rs
--- a/gen/cmd/src/test.rs
+++ b/gen/cmd/src/test.rs
@@ -32,7 +32,7 @@ OPTIONS:
parse or even require the given paths to exist; they simply go
into the generated C++ code as #include lines.
\x20
- -o, --output <output>
+ ... | Consider allowing one cxxbridge cli invocation to emit both header and cc
As currently implemented, two invocations of the cli command are required and the output goes to stdout.
```bash
$ cxxbridge path/to/lib.rs --header > generated.h
$ cxxbridge path/to/lib.rs > generated.cc
```
In some Starlark-based envir... | c86633d53c1150048cbcb2605403ffb227c853b4 | [
"app::test::test_help"
] | [
"gen::tests::test_cpp",
"gen::tests::test_annotation"
] | [] | [] | |
1549106cb02a216c2182e3c75cfc8aad13834d13 | diff --git a/gen/src/write.rs b/gen/src/write.rs
--- a/gen/src/write.rs
+++ b/gen/src/write.rs
@@ -619,7 +619,6 @@ fn write_cxx_function_shim(out: &mut OutFile, efn: &ExternFn, impl_annotations:
}
match &efn.ret {
Some(Type::Ref(_)) => write!(out, "&"),
- Some(Type::Str(_)) if !indirect_return... | dtolnay__cxx-391 | 391 | [
"118"
] | 0.5 | dtolnay/cxx | 2020-11-01T00:37:53Z | diff --git a/tests/cxx_gen.rs b/tests/cxx_gen.rs
--- a/tests/cxx_gen.rs
+++ b/tests/cxx_gen.rs
@@ -18,7 +18,7 @@ fn test_extern_c_function() {
let output = str::from_utf8(&generated.implementation).unwrap();
// To avoid continual breakage we won't test every byte.
// Let's look for the major features.
- ... | Remove Str::Repr nested struct from cxx.h
This should be implemented some other way. It shouldn't be necessary to include this "private" public nested struct which is only supposed to be used by our code generator. Instead the code generator should be built using only public constructors and member functions on rust::S... | f47403fccd1222f407fe316aad1a5a3cb0c777cf | [
"test_impl_annotation",
"test_extern_c_function"
] | [
"test_c_method_calls",
"test_c_ns_method_calls",
"test_c_call_r",
"test_c_return",
"test_c_take",
"test_c_try_return",
"test_enum_representations",
"test_extern_opaque",
"test_extern_trivial",
"test_rust_name_attribute",
"test_deref_null - should panic",
"src/extern_type.rs - extern_type::Exte... | [] | [] | |
e35673d7debe16222c1667131e51969c093e225c | diff --git a/gen/src/write.rs b/gen/src/write.rs
--- a/gen/src/write.rs
+++ b/gen/src/write.rs
@@ -1245,7 +1245,12 @@ fn write_unique_ptr_common(out: &mut OutFile, ty: &Type, types: &Types) {
let instance = to_mangled(&out.namespace, ty);
let can_construct_from_value = match ty {
- Type::Ident(ident)... | dtolnay__cxx-361 | 361 | [
"360"
] | 0.5 | dtolnay/cxx | 2020-10-12T23:21:03Z | diff --git a/tests/BUCK b/tests/BUCK
--- a/tests/BUCK
+++ b/tests/BUCK
@@ -3,7 +3,10 @@ load("//tools/buck:rust_cxx_bridge.bzl", "rust_cxx_bridge")
rust_test(
name = "test",
srcs = ["test.rs"],
- deps = [":ffi"],
+ deps = [
+ ":ffi",
+ "//:cxx",
+ ],
)
rust_library(
diff --git a/te... | Allow UniquePtr::new on Trivial ExternTypes
Example from autocxx:
```rust
mod ffi {
unsafe impl cxx::ExternType for bindgen::A {
type Id = cxx::type_id!("A");
type Kind = cxx::kind::Trivial;
}
mod bindgen {
#[repr(C)]
pub struct A {
pub a: u32,
... | f47403fccd1222f407fe316aad1a5a3cb0c777cf | [
"test_extern_trivial"
] | [
"test_impl_annotation",
"test_extern_c_function",
"test_c_method_calls",
"test_c_call_r",
"test_enum_representations",
"test_c_return",
"test_c_try_return",
"test_c_take",
"test_extern_opaque",
"test_rust_name_attribute",
"test_deref_null - should panic",
"src/extern_type.rs - extern_type::Ext... | [] | [] | |
bbf32a9e81e8965e77b5b4035b10c5ccab3ad070 | diff --git a/src/ast/mod.rs b/src/ast/mod.rs
--- a/src/ast/mod.rs
+++ b/src/ast/mod.rs
@@ -35,7 +35,7 @@ pub use self::query::{
OrderByExpr, Query, Select, SelectInto, SelectItem, SetExpr, SetOperator, TableAlias,
TableFactor, TableWithJoins, Top, Values, With,
};
-pub use self::value::{DateTimeField, TrimWh... | apache__datafusion-sqlparser-rs-697 | 697 | [
"690"
] | 0.26 | apache/datafusion-sqlparser-rs | 2022-10-31T05:44:57Z | diff --git a/src/test_utils.rs b/src/test_utils.rs
--- a/src/test_utils.rs
+++ b/src/test_utils.rs
@@ -142,6 +142,8 @@ pub fn all_dialects() -> TestedDialects {
Box::new(SnowflakeDialect {}),
Box::new(HiveDialect {}),
Box::new(RedshiftSqlDialect {}),
+ Box::new(MySqlDia... | Fix test-util `fn all_dialects()` to test all dialects actually
This is for internal but some fixes may be for users.
In [tests/sqlparser_common.rs](https://github.com/sqlparser-rs/sqlparser-rs/blob/main/tests/sqlparser_common.rs) (⚠️ linked page may freeze your browser), a lot of test cases depend on [fn all_dialec... | bbf32a9e81e8965e77b5b4035b10c5ccab3ad070 | [
"parse_at_timezone",
"parse_collate",
"parse_collate_after_parens",
"parse_delete_statement"
] | [
"dialect::tests::test_is_dialect",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_cube_display",
"ast::tests::test_rollup_display",
"tokenizer::tests::tokenize_bitwise_op",
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::tests::test_window_frame_default",
"ast... | [] | [] | |
814367a6abe319bb8c9e030a4a804cd6c9cf2231 | diff --git a/src/parser.rs b/src/parser.rs
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -5254,7 +5254,9 @@ impl<'a> Parser<'a> {
let table = self.parse_table_and_joins()?;
self.expect_keyword(Keyword::SET)?;
let assignments = self.parse_comma_separated(Parser::parse_assignment)?;
- let f... | apache__datafusion-sqlparser-rs-694 | 694 | Thanks for the report. A contribution PR would be most welcome
I'll take a look. | [
"534"
] | 0.26 | apache/datafusion-sqlparser-rs | 2022-10-28T14:28:54Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -24,7 +24,7 @@ use sqlparser::ast::SelectItem::UnnamedExpr;
use sqlparser::ast::*;
use sqlparser::dialect::{
AnsiDialect, BigQueryDialect, ClickHouseDialect, GenericDialect, HiveD... | UPDATE ... FROM ( subquery ) only supported in PostgreSQL
Hi 👋
The `UPDATE <table> FROM (SELECT ...)` statement is only supported with `PostgreSQL` dialect.
It should be also supported for other technologies.
Here are a few examples:
- [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/... | bbf32a9e81e8965e77b5b4035b10c5ccab3ad070 | [
"parse_update_set_from"
] | [
"ast::tests::test_window_frame_default",
"dialect::tests::test_is_dialect",
"tokenizer::tests::tokenize_comment",
"tokenizer::tests::tokenize_bitwise_op",
"tokenizer::tests::tokenize_explain_analyze_select",
"tokenizer::tests::tokenize_invalid_string_cols",
"ast::helpers::stmt_create_table::tests::test_... | [] | [] |
1e0460a7dfad4a6767d718a9d849b23c8b61ee80 | diff --git a/src/dialect/snowflake.rs b/src/dialect/snowflake.rs
--- a/src/dialect/snowflake.rs
+++ b/src/dialect/snowflake.rs
@@ -22,9 +22,7 @@ use crate::ast::helpers::stmt_data_loading::{
DataLoadingOption, DataLoadingOptionType, DataLoadingOptions, StageLoadSelectItem,
StageParamsObject,
};
-use crate::a... | apache__datafusion-sqlparser-rs-1453 | 1,453 | [
"1452"
] | 0.51 | apache/datafusion-sqlparser-rs | 2024-10-02T12:57:48Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -47,6 +47,7 @@ mod test_utils;
#[cfg(test)]
use pretty_assertions::assert_eq;
+use sqlparser::ast::ColumnOption::Comment;
use sqlparser::ast::Expr::{Identifier, UnaryOp};
use sqlpa... | Table comment is always parsed as CommentDef::WithoutEq
Say I have the following table:
```sql
CREATE TABLE users (
user_id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '口座内部ID',
user_name VARCHAR(255) NOT NULL,
PRIMARY KEY (user_id),
) COMMENT = 'users of the service';
```
And I parse and re-build it... | ee90373d35e47823c7c0b3afc39beafd1d29f9ca | [
"test_parse_inline_comment",
"parse_create_table_comment"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_interval_display",
"ast::tests::test_cube_display",
"ast::tests::test_one_or_many_with_parens_as_ref",
"... | [] | [] | |
71c35d4dfddc89cfdd8f67bdc4c5d4e701a355e8 | diff --git a/src/parser/mod.rs b/src/parser/mod.rs
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -5024,6 +5024,27 @@ impl<'a> Parser<'a> {
break;
}
}
+
+ // BigQuery accepts any number of quoted identifiers of a table name.
+ // https://cloud.google.com/bigquery... | apache__datafusion-sqlparser-rs-971 | 971 | Why do you care whether it's parsed as `[Ident("d.s.t")]` or `[Ident("d"), Ident("s"), Ident("t")]`? Maybe you could consume both.
The method is here
https://github.com/sqlparser-rs/sqlparser-rs/blob/097e7ad56ed09e5757fbf0719d07194aa93521e8/src/parser.rs#L4684-L4695
and can be customized like this
https://github.... | [
"889"
] | 0.37 | apache/datafusion-sqlparser-rs | 2023-09-20T19:42:47Z | diff --git a/src/test_utils.rs b/src/test_utils.rs
--- a/src/test_utils.rs
+++ b/src/test_utils.rs
@@ -159,6 +159,24 @@ impl TestedDialects {
}
}
+ /// Ensures that `sql` parses as a single [`Select`], and that additionally:
+ ///
+ /// 1. parsing `sql` results in the same [`Statement`] as pars... | BigQuery ignores identifiers in FROM clause
tl;dr - SELECT * from d.s.t and SELECT * from \`d.s.t\` are equivalent in BigQuery and should return the same response from sqlparser.
Let's say I have database d, with schema s and table t.
In Snowflake, the following query will work - SELECT * FROM d.s.t
However, t... | 71c35d4dfddc89cfdd8f67bdc4c5d4e701a355e8 | [
"parse_table_identifiers"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::tests::test_cube_display",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_interval_display",
"ast::tests::test_rollup_display",
"ast::tests::test... | [] | [] |
2593dcfb79bb8709a6014673d47ffefcf9a68e20 | diff --git a/src/parser/mod.rs b/src/parser/mod.rs
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -3941,9 +3941,15 @@ impl<'a> Parser<'a> {
match next_token.token {
Token::Word(w) if w.keyword == Keyword::PRIMARY || w.keyword == Keyword::UNIQUE => {
let is_primary = w.keyword ... | apache__datafusion-sqlparser-rs-962 | 962 | <img width="1090" alt="image" src="https://github.com/sqlparser-rs/sqlparser-rs/assets/82564604/004df0e9-f7e5-40ce-910a-58afb7878710">
<img width="922" alt="image" src="https://github.com/sqlparser-rs/sqlparser-rs/assets/82564604/3a1eb52f-e961-4587-a711-8b54edb3568d">
Should we add a branch judgment, if the n... | [
"961"
] | 0.37 | apache/datafusion-sqlparser-rs | 2023-08-31T11:42:51Z | diff --git a/tests/sqlparser_mysql.rs b/tests/sqlparser_mysql.rs
--- a/tests/sqlparser_mysql.rs
+++ b/tests/sqlparser_mysql.rs
@@ -297,6 +297,62 @@ fn parse_create_table_auto_increment() {
}
}
+#[test]
+fn parse_create_table_unique_key() {
+ let sql = "CREATE TABLE foo (id INT PRIMARY KEY AUTO_INCREMENT, bar... | Error: SchemaParse(ParserError("Expected a list of columns in parentheses, found: KEY"))
The SQL statement I want to parse is:
```sql
CREATE TABLE `funds_sale` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '',
PRIMARY KEY (`id`, `cid`),
UNIQUE KEY `uk_bill_str` (`cid`, `bill_str`),
KEY `idx_biz_str` ... | 71c35d4dfddc89cfdd8f67bdc4c5d4e701a355e8 | [
"parse_create_table_unique_key"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::tests::test_cube_display",
"ast::tests::test_window_frame_default",
"ast::tests::test_interval_display",
"ast::tests::test_rollup_display",
"dialect::tests::t... | [] | [] |
f60a6f758ce12aa84fa3801a38c9501f55f245ef | diff --git a/src/ast/mod.rs b/src/ast/mod.rs
--- a/src/ast/mod.rs
+++ b/src/ast/mod.rs
@@ -1540,8 +1540,15 @@ pub enum Statement {
///
/// Note: This is a MySQL-specific statement.
Use { db_name: Ident },
- /// `{ BEGIN [ TRANSACTION | WORK ] | START TRANSACTION } ...`
- StartTransaction { modes: V... | apache__datafusion-sqlparser-rs-935 | 935 | [
"919"
] | 0.36 | apache/datafusion-sqlparser-rs | 2023-07-25T11:35:11Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -5732,7 +5732,7 @@ fn lateral_derived() {
#[test]
fn parse_start_transaction() {
match verified_stmt("START TRANSACTION READ ONLY, READ WRITE, ISOLATION LEVEL SERIALIZABLE") {
- ... | "BEGIN TRANSACTION" gets stringified as "START TRANSACTION"
Parsing the following:
```sql
BEGIN;
```
and then calling `.to_string()` on the parsed statement, results in
```sql
START TRANSACTION;
```
The `START` syntax in not supported in SQLite. But ideally, the parser would keep track of which variant... | 9a39afbe07b6eecd8819fe1f7d9af2b4aad3a6d7 | [
"parse_start_transaction"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::tests::test_cube_display",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_interval_display",
"ast::tests::test_window_frame_default",
"ast::tests... | [] | [] | |
481551c0753312550fc5f4d94319e9a92497caad | diff --git a/src/ast/value.rs b/src/ast/value.rs
--- a/src/ast/value.rs
+++ b/src/ast/value.rs
@@ -123,6 +123,7 @@ impl fmt::Display for Value {
pub enum DateTimeField {
Year,
Month,
+ Week,
Day,
Hour,
Minute,
diff --git a/src/ast/value.rs b/src/ast/value.rs
--- a/src/ast/value.rs
+++ b/src... | apache__datafusion-sqlparser-rs-436 | 436 | [
"435"
] | 0.15 | apache/datafusion-sqlparser-rs | 2022-03-11T02:39:58Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -1384,6 +1384,7 @@ fn parse_extract() {
one_statement_parses_to("SELECT EXTRACT(year from d)", "SELECT EXTRACT(YEAR FROM d)");
verified_stmt("SELECT EXTRACT(MONTH FROM d)");
... | extract operator: add support for `week` keywords
Support ` EXTRACT(WEEK FROM to_timestamp('2020-09-08T12:00:00+00:00'))`
| 803fd6c970cced96442c56d5952e8cf671bf10e3 | [
"parse_extract"
] | [
"ast::tests::test_cube_display",
"ast::tests::test_rollup_display",
"dialect::tests::test_is_dialect",
"ast::tests::test_window_frame_default",
"ast::tests::test_grouping_sets_display",
"parser::tests::test_prev_index",
"tokenizer::tests::tokenize_comment",
"tokenizer::tests::tokenize_bitwise_op",
"... | [] | [] | |
f60a6f758ce12aa84fa3801a38c9501f55f245ef | diff --git a/src/parser.rs b/src/parser.rs
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -957,17 +957,18 @@ impl<'a> Parser<'a> {
}
pub fn parse_time_functions(&mut self, name: ObjectName) -> Result<Expr, ParserError> {
- let (args, order_by) = if self.consume_token(&Token::LParen) {
- self.p... | apache__datafusion-sqlparser-rs-930 | 930 | Thanks @lovasoa the "do we have trailing parens" is already tracked by the "special" flag:
https://github.com/sqlparser-rs/sqlparser-rs/blob/eb288487a6a938b45004deda850e550a74fcf935/src/ast/mod.rs#L3494-L3496
https://github.com/sqlparser-rs/sqlparser-rs/blob/eb288487a6a938b45004deda850e550a74fcf935/src/ast/mod.r... | [
"918"
] | 0.36 | apache/datafusion-sqlparser-rs | 2023-07-22T21:24:00Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -6703,90 +6703,37 @@ fn parse_offset_and_limit() {
#[test]
fn parse_time_functions() {
- let sql = "SELECT CURRENT_TIMESTAMP()";
- let select = verified_only_select(sql);
- ... | sqlparser breaks CURRENT_TIMESTAMP for sqlite
In [SQLPage](https://github.com/lovasoa/SQLpage), we parse SQL queries using sqlparser in order to be able to modify them, and then dump them as text to run them on the database. This requires the process of parsing and then stringifying back not to break the semantics nor ... | 9a39afbe07b6eecd8819fe1f7d9af2b4aad3a6d7 | [
"parse_time_functions"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::tests::test_cube_display",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_interval_display",
"ast::tests::test_window_frame_default",
"dialect::t... | [] | [] |
48fa79d744fdc9c3aa1060c7eb35ea962eeb6837 | diff --git a/src/parser.rs b/src/parser.rs
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -3774,7 +3774,12 @@ impl<'a> Parser<'a> {
});
}
- let variable = self.parse_object_name()?;
+ let variable = if self.parse_keywords(&[Keyword::TIME, Keyword::ZONE]) {
+ ObjectName(vec![... | apache__datafusion-sqlparser-rs-617 | 617 | @435201823 which sqlparser version did you use that worked? i switched back to 0.5.0 but it still not works | [
"303"
] | 0.23 | apache/datafusion-sqlparser-rs | 2022-09-19T17:37:31Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -4663,6 +4663,52 @@ fn parse_set_transaction() {
}
}
+#[test]
+fn parse_set_variable() {
+ match verified_stmt("SET SOMETHING = '1'") {
+ Statement::SetVariable {
+ ... | can not parse "SET TIME ZONE 'UTC'"
It was normal to parse "SET TIME ZONE 'UTC'" a few days ago. Today I tried to parse "SET TIME ZONE 'UTC'" and there was an error.
```
pub fn sql_parse_test() {
use sqlparser::dialect::GenericDialect;
use sqlparser::parser::Parser;
let sql = r#"set time zone 'UTC'"... | fccae77c5e3056214b2d06902577925ec8d5549d | [
"parse_set_time_zone"
] | [
"ast::tests::test_grouping_sets_display",
"ast::tests::test_cube_display",
"ast::tests::test_window_frame_default",
"dialect::tests::test_is_dialect",
"parser::tests::test_prev_index",
"ast::tests::test_rollup_display",
"tokenizer::tests::tokenize_bitwise_op",
"parser::tests::test_parse_limit",
"tok... | [] | [] |
0bb49cea9908e0d7389a46519e368efeeab89e79 | diff --git a/src/parser.rs b/src/parser.rs
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -570,7 +570,7 @@ impl<'a> Parser<'a> {
})
}
}
- Token::Placeholder(_) => {
+ Token::Placeholder(_) | Token::Colon | Token::AtSign => {
self.prev... | apache__datafusion-sqlparser-rs-604 | 604 | [
"603"
] | 0.22 | apache/datafusion-sqlparser-rs | 2022-09-05T19:50:24Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -22,6 +22,7 @@
mod test_utils;
use matches::assert_matches;
+use sqlparser::ast::SelectItem::UnnamedExpr;
use sqlparser::ast::*;
use sqlparser::dialect::{
AnsiDialect, BigQuer... | Placeholders can contain underscores
The following prepared statement [parses correctly](http://sqlfiddle.com/#!5/9eecb7/15986) in SQLite:
```sql
select $a_b_c_héhé;
```
However, it fails to parse in sqlparser-rs, which only accepts `[a-zA-Z0-9]` in placeholders.
| 0bb49cea9908e0d7389a46519e368efeeab89e79 | [
"test_placeholder"
] | [
"ast::tests::test_cube_display",
"ast::tests::test_rollup_display",
"ast::tests::test_window_frame_default",
"tokenizer::tests::tokenize_comment_at_eof",
"tokenizer::tests::tokenize_comment",
"dialect::tests::test_is_dialect",
"ast::tests::test_grouping_sets_display",
"tokenizer::tests::tokenize_expla... | [] | [] | |
31ba0012f747c9e2fc551b95fd2ee3bfa46b12e6 | diff --git a/src/ast/mod.rs b/src/ast/mod.rs
--- a/src/ast/mod.rs
+++ b/src/ast/mod.rs
@@ -331,13 +331,14 @@ pub enum Expr {
substring_from: Option<Box<Expr>>,
substring_for: Option<Box<Expr>>,
},
- /// TRIM([BOTH | LEADING | TRAILING] <expr> [FROM <expr>])\
+ /// TRIM([BOTH | LEADING | TRA... | apache__datafusion-sqlparser-rs-573 | 573 | [
"568"
] | 0.20 | apache/datafusion-sqlparser-rs | 2022-08-12T20:35:41Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -3928,7 +3928,15 @@ fn parse_trim() {
"SELECT TRIM(TRAILING 'xyz' FROM 'xyzfooxyz')",
);
+ one_statement_parses_to(
+ "SELECT TRIM('xyz' FROM 'xyzfooxyz')",
+ ... | Trim syntax without trimWhere and From not supported.
Postgresql syntax for trim `trim ( [ LEADING | TRAILING | BOTH ] [ characters text ] FROM string text ) → text` allows the pattern of
`trim(chars from string)`.
sqlparser currently fails with this combo of no leading/trailing/both flag and the `from` keyword sp... | 31ba0012f747c9e2fc551b95fd2ee3bfa46b12e6 | [
"parse_trim"
] | [
"ast::tests::test_rollup_display",
"ast::tests::test_cube_display",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_window_frame_default",
"dialect::tests::test_is_dialect",
"parser::tests::test_prev_index",
"tokenizer::tests::tokenize_bitwise_op",
"tokenizer::tests::tokenize_comment_at_eo... | [] | [] | |
f7f14df4b14256a05f1dd41c7b03552fd8ea0fa1 | diff --git a/src/ast/mod.rs b/src/ast/mod.rs
--- a/src/ast/mod.rs
+++ b/src/ast/mod.rs
@@ -880,9 +880,9 @@ pub enum WindowFrameBound {
/// `CURRENT ROW`
CurrentRow,
/// `<N> PRECEDING` or `UNBOUNDED PRECEDING`
- Preceding(Option<u64>),
+ Preceding(Option<Box<Expr>>),
/// `<N> FOLLOWING` or `UN... | apache__datafusion-sqlparser-rs-655 | 655 | [
"631"
] | 0.25 | apache/datafusion-sqlparser-rs | 2022-10-05T11:01:52Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -2865,13 +2865,17 @@ fn parse_window_functions() {
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), \
avg(bar) OVER (ORDER BY a \
RANGE ... | Support "date" and "timestamp" inside window frame RANGE Queries
# Support INTERVAL in window RANGE Queries
Currently, we do not support the queries taking `date` or `timestamp` for range inside window frames. Following query
```sql
SELECT
COUNT(*) OVER (ORDER BY ts RANGE BETWEEN '1 DAY' PRECEDING AND '1 DAY'... | cacdf3305f33319bed4e870227cdd541b4c9f947 | [
"parse_window_functions"
] | [
"ast::tests::test_cube_display",
"ast::tests::test_window_frame_default",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_rollup_display",
"parser::tests::test_parse_data_type::test_ansii_character_string_types",
"parser::tests::test_parse_data_type::test_ansii_datetime_types",
"dialect::tes... | [] | [] | |
fccae77c5e3056214b2d06902577925ec8d5549d | diff --git a/src/parser.rs b/src/parser.rs
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -3142,6 +3142,10 @@ impl<'a> Parser<'a> {
Ok(DataType::Char(self.parse_optional_precision()?))
}
}
+ Keyword::CLOB => Ok(DataType::Clob(self.parse_precision... | apache__datafusion-sqlparser-rs-618 | 618 | I think this would make a nice contribution to the library -- feel free to make a PR 👍 | [
"518"
] | 0.23 | apache/datafusion-sqlparser-rs | 2022-09-21T15:48:43Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -1647,6 +1647,46 @@ fn parse_cast() {
},
expr_from_projection(only(&select.projection))
);
+
+ let sql = "SELECT CAST(id AS CLOB(50)) FROM customer";
+ let s... | VARBINARY or BLOB columns not parsed
I see the DataType enum has variants for these but it doesn't parse them correctly, or perhaps I am doing something wrong.
Sql:
```mysql
CREATE TABLE IF NOT EXISTS `data` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
`key` VARCHAR(255) NOT ... | fccae77c5e3056214b2d06902577925ec8d5549d | [
"parse_cast"
] | [
"ast::tests::test_cube_display",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_rollup_display",
"ast::tests::test_window_frame_default",
"dialect::tests::test_is_dialect",
"parser::tests::test_prev_index",
"parser::tests::test_parse_limit",
"tokenizer::tests::tokenize_bitwise_op",
"tok... | [] | [] |
20f7ac59e38d52e293476b7ad844e7f744a16c43 | diff --git a/src/parser/mod.rs b/src/parser/mod.rs
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -1474,6 +1474,11 @@ impl<'a> Parser<'a> {
let result = self.parse_comma_separated(|p| p.parse_tuple(true, true))?;
self.expect_token(&Token::RParen)?;
Ok(Expr::Rollup(... | apache__datafusion-sqlparser-rs-1347 | 1,347 | I would recommend finding a sql reference for the syntax (aka which database invented / used this syntax) to understand what `()` means in this context and then update the parser accordingly
() is usually used in GROUPING SETS, ROLLUP, etc. It is used to include "single group" into the list of sets, for example:
```sq... | [
"1092"
] | 0.48 | apache/datafusion-sqlparser-rs | 2024-07-19T10:57:16Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -42,6 +42,7 @@ mod test_utils;
#[cfg(test)]
use pretty_assertions::assert_eq;
+use sqlparser::ast::Expr::Identifier;
use sqlparser::test_utils::all_dialects_except;
#[test]
diff ... | GROUP BY () not supported
Hello. First of all, thanks for this amazing project!
I've ran into an issue that explicit `GROUP BY ()` is not supported.
For example, when we write:
`SELECT SUM (value) from sales`,
it is supposed to be the same as:
`SELECT SUM (value) from sales group by ()`,
but the latter is not p... | 20f7ac59e38d52e293476b7ad844e7f744a16c43 | [
"test_group_by_nothing"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::tests::test_rollup_display",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_interval_display",
"ast::tests::test_cube_display",
"dialect::tests::... | [] | [] |
9108bffc9a021aa1f5137381c8f3aec47e71e319 | diff --git a/src/ast/helpers/stmt_create_table.rs b/src/ast/helpers/stmt_create_table.rs
--- a/src/ast/helpers/stmt_create_table.rs
+++ b/src/ast/helpers/stmt_create_table.rs
@@ -496,9 +496,9 @@ impl TryFrom<Statement> for CreateTableBuilder {
}
}
-/// Helper return type when parsing configuration for a BigQuer... | apache__datafusion-sqlparser-rs-1338 | 1,338 | [
"1281"
] | 0.48 | apache/datafusion-sqlparser-rs | 2024-07-10T13:09:35Z | diff --git a/tests/sqlparser_postgres.rs b/tests/sqlparser_postgres.rs
--- a/tests/sqlparser_postgres.rs
+++ b/tests/sqlparser_postgres.rs
@@ -4039,6 +4039,50 @@ fn parse_create_table_with_alias() {
}
}
+#[test]
+fn parse_create_table_with_partition_by() {
+ let sql = "CREATE TABLE t1 (a INT, b TEXT) PARTITI... | Partition by not supported - postgre
Have this query:
```
CREATE TABLE measurement (
city_id int not null,
logdate date not null,
peaktemp int,
unitsales int
) PARTITION BY RANGE (logdate);
```
Got this error:
`sql parser error: Expected end of statement, found: PA... | 20f7ac59e38d52e293476b7ad844e7f744a16c43 | [
"parse_create_table_with_partition_by"
] | [
"ast::tests::test_window_frame_default",
"dialect::tests::identifier_quote_style",
"dialect::tests::test_dialect_from_str",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_cube_display",
"dialect::tests::test_is_dialect",
... | [] | [] | |
7ea47c71fb01e88053ca276e33af38bb23ccb92f | diff --git a/src/ast/data_type.rs b/src/ast/data_type.rs
--- a/src/ast/data_type.rs
+++ b/src/ast/data_type.rs
@@ -219,6 +219,10 @@ pub enum DataType {
/// [hive]: https://docs.cloudera.com/cdw-runtime/cloud/impala-sql-reference/topics/impala-struct.html
/// [bigquery]: https://cloud.google.com/bigquery/docs/... | apache__datafusion-sqlparser-rs-1075 | 1,075 | @alamb I was wondering; this seems to be a mutually exclusive logic.
Other databases require the data type, while SQLite doesn't.
Is it reasonable to assume that the GenericDialect behavior would be to allow untyped columns...?
> Is it reasonable to assume that the GenericDialect behavior would be to allow untype... | [
"743"
] | 0.41 | apache/datafusion-sqlparser-rs | 2023-12-24T11:49:33Z | diff --git a/tests/sqlparser_sqlite.rs b/tests/sqlparser_sqlite.rs
--- a/tests/sqlparser_sqlite.rs
+++ b/tests/sqlparser_sqlite.rs
@@ -221,6 +221,11 @@ fn parse_create_table_gencol() {
sqlite_and_generic().verified_stmt("CREATE TABLE t1 (a INT, b INT AS (a * 2) STORED)");
}
+#[test]
+fn parse_create_table_untyp... | SQLite dialect doesn't support typeless columns
SQLite supports untyped columns in the schema, like in this example:
```sql
CREATE TABLE log_data (
log_id INTEGER NOT NULL,
key TEXT NOT NULL,
value,
PRIMARY KEY (log_id, key),
FOREIGN KEY(log_id) REFERENCES logs(id) ON DELETE CASCADE
);
``... | 3ec337ec5f44bbb406c5806cb98643403f196fd2 | [
"parse_create_table_untyped"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::tests::test_cube_display",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_interval_display",
"ast::tests::test_rollup_display",
"ast::tests::test... | [] | [] |
8d97330d42fa9acf63d8bf6412b762948e025496 | diff --git a/src/ast/ddl.rs b/src/ast/ddl.rs
--- a/src/ast/ddl.rs
+++ b/src/ast/ddl.rs
@@ -600,6 +600,8 @@ pub enum ColumnOption {
sequence_options: Option<Vec<SequenceOptions>>,
generation_expr: Option<Expr>,
generation_expr_mode: Option<GeneratedExpressionMode>,
+ /// false if 'GENER... | apache__datafusion-sqlparser-rs-1058 | 1,058 | #1051 fixed `VIRTUAL`. I'll work on making `GENERATED ALWAYS` optional, but probably not until next week. | [
"1050"
] | 0.40 | apache/datafusion-sqlparser-rs | 2023-11-29T10:30:35Z | diff --git a/tests/sqlparser_mysql.rs b/tests/sqlparser_mysql.rs
--- a/tests/sqlparser_mysql.rs
+++ b/tests/sqlparser_mysql.rs
@@ -517,6 +517,10 @@ fn parse_create_table_gencol() {
let sql_stored = "CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a * 2) STORED)";
mysql_and_generic().verified_stmt(sql_sto... | Support more forms of generated columns for SQLite dialect
SQLite allows some ways of defining a generated column which sqlparser currently rejects.
First, the `GENERATED ALWAYS` keywords are optional:
```rust
Parser::parse_sql(&SQLiteDialect {},
"CREATE TABLE t1(a INT, b INT AS (a * 2) STORED);")?;
```
... | 8d97330d42fa9acf63d8bf6412b762948e025496 | [
"parse_create_table_gencol"
] | [
"ast::tests::test_grouping_sets_display",
"ast::tests::test_cube_display",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::tests::test_interval_display",
"ast::tests::test_rollup_display",
"ast::tests::test... | [] | [] |
f16c1afed0fa273228e74a633f3885c9c6609911 | diff --git a/src/parser/mod.rs b/src/parser/mod.rs
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -3611,21 +3611,13 @@ impl<'a> Parser<'a> {
/// Parse a UNCACHE TABLE statement
pub fn parse_uncache_table(&mut self) -> Result<Statement, ParserError> {
- let has_table = self.parse_keyword(Keyword::... | apache__datafusion-sqlparser-rs-1320 | 1,320 | Thanks for the report -- sure sounds like a bug to me
i'll take this | [
"1244"
] | 0.47 | apache/datafusion-sqlparser-rs | 2024-06-20T10:36:02Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -8451,19 +8451,19 @@ fn parse_uncache_table() {
let res = parse_sql_statements("UNCACHE TABLE 'table_name' foo");
assert_eq!(
- ParserError::ParserError("Expected: an ... | UNCACHE fails to parse with a semicolon
`parse_sql` normally doesn't care whether a single statement is terminated by a semicolon or end of string, but when parsing `UNCACHE` it does.
This deviation seems like a bug.
Discovered on sqlparser v0.43.1, tested on v0.45.0:
```rust
use sqlparser::{
dialect::Ge... | 17e5c0c1b6c3c52e5ffd0d2caa4aad7bd7d35958 | [
"parse_uncache_table"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::tests::test_cube_display",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_rollup_display",
"ast::tests::test_interval_display",
"ast::tests::test... | [] | [] |
79af31b6727fbe60e21705f4bbf8dafc59516e42 | diff --git a/src/parser/mod.rs b/src/parser/mod.rs
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -3116,7 +3116,7 @@ impl<'a> Parser<'a> {
/// Report `found` was encountered instead of `expected`
pub fn expected<T>(&self, expected: &str, found: TokenWithLocation) -> Result<T, ParserError> {
parse... | apache__datafusion-sqlparser-rs-1319 | 1,319 | Thanks fr the report. I agree it looks like a bug. PRs to fix it most welcome
I think i can take this on. (don't know how i can assign this) | [
"1259"
] | 0.47 | apache/datafusion-sqlparser-rs | 2024-06-19T19:08:08Z | diff --git a/src/parser/mod.rs b/src/parser/mod.rs
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -11581,7 +11581,7 @@ mod tests {
assert_eq!(
ast,
Err(ParserError::TokenizerError(
- "Unterminated string literal at Line: 1, Column 5".to_string()
+ "Un... | Add missing colon to sql parser error message after "Column" and "Expected"
sql parser error messages are missing a colon after "Column" and "Excepted"
How it is:
`sql parser error: Expected (, found: 2345 at Line: 2, Column 8`
How it should be IMO:
`sql parser error: Expected: (, found: 2345 at Line: 2, Column... | 17e5c0c1b6c3c52e5ffd0d2caa4aad7bd7d35958 | [
"parser::tests::test_parser_error_loc",
"parser::tests::test_tokenizer_error_loc",
"tokenizer::tests::tokenizer_error_impl",
"parse_big_query_declare",
"parse_invalid_brackets",
"parse_merge_invalid_statements",
"parse_trailing_comma",
"test_bigquery_trim",
"test_bigquery_create_function",
"parse_... | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::tests::test_rollup_display",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_interval_display",
"ast::tests::test_cube_display",
"ast::tests::test... | [] | [] |
0330f9def5ebd6b7813dc4656f40edc717dbd0a3 | diff --git a/src/parser/mod.rs b/src/parser/mod.rs
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -42,6 +42,9 @@ pub enum ParserError {
RecursionLimitExceeded,
}
+// avoid clippy type_complexity warnings
+type ParsedAction = (Keyword, Option<Vec<Ident>>);
+
// Use `Parser::expected` instead, if possible
m... | apache__datafusion-sqlparser-rs-1318 | 1,318 | [
"1211"
] | 0.47 | apache/datafusion-sqlparser-rs | 2024-06-17T22:41:52Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -8894,6 +8894,11 @@ fn parse_trailing_comma() {
"CREATE TABLE employees (name TEXT, age INT)",
);
+ trailing_commas.one_statement_parses_to(
+ "GRANT USAGE, SEL... | Error on some `GRANT`s when trailing commas are enabled
# How to reproduce
```rs
use sqlparser::{
dialect::GenericDialect,
parser::{Parser, ParserError, ParserOptions},
};
fn main() -> Result<(), ParserError> {
let dialect = GenericDialect {};
let options = ParserOptions::new().with_trailing... | 17e5c0c1b6c3c52e5ffd0d2caa4aad7bd7d35958 | [
"parse_trailing_comma"
] | [
"ast::tests::test_cube_display",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_rollup_display",
"ast::tests::test_window_frame_default",
"dialect::tes... | [] | [] | |
be77ce50ca34958f94bc05d92795b38ca286614a | diff --git a/src/parser/mod.rs b/src/parser/mod.rs
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -20,7 +20,10 @@ use alloc::{
vec,
vec::Vec,
};
-use core::fmt;
+use core::{
+ fmt::{self, Display},
+ str::FromStr,
+};
use log::debug;
diff --git a/src/parser/mod.rs b/src/parser/mod.rs
--- a/src... | apache__datafusion-sqlparser-rs-1305 | 1,305 | [
"1303"
] | 0.47 | apache/datafusion-sqlparser-rs | 2024-06-10T19:49:29Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -9991,3 +9991,18 @@ fn parse_select_wildcard_with_except() {
"sql parser error: Expected identifier, found: )"
);
}
+
+#[test]
+fn parse_auto_increment_too_large() {
+ ... | Return error when AUTO_INCREMENT offset is too large
Currently passing a too large `AUTO_INCREMENT` value will cause a panic.
```
panicked at src/parser/mod.rs:5284:62:
literal int: ParseIntError { kind: PosOverflow }
```
Discovered by running the fuzz target.
| 17e5c0c1b6c3c52e5ffd0d2caa4aad7bd7d35958 | [
"parse_auto_increment_too_large"
] | [
"ast::tests::test_window_frame_default",
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::tests::test_cube_display",
"ast::tests::test_interval_display",
"dialect::tests::test_dialect_from_str",
"dialect::tests::test_is_dialect",
"ast::tests::test_rollup_display",
"tokenize... | [] | [] | |
a86c58b1c93960d50476713ff56e02bf94d41436 | diff --git a/src/ast/mod.rs b/src/ast/mod.rs
--- a/src/ast/mod.rs
+++ b/src/ast/mod.rs
@@ -4908,6 +4908,10 @@ pub enum FunctionArgumentClause {
///
/// See <https://trino.io/docs/current/functions/aggregate.html>.
OnOverflow(ListAggOnOverflow),
+ /// The `SEPARATOR` clause to the [`GROUP_CONCAT`] func... | apache__datafusion-sqlparser-rs-1256 | 1,256 | [
"1225"
] | 0.46 | apache/datafusion-sqlparser-rs | 2024-05-04T17:22:54Z | diff --git a/tests/sqlparser_mysql.rs b/tests/sqlparser_mysql.rs
--- a/tests/sqlparser_mysql.rs
+++ b/tests/sqlparser_mysql.rs
@@ -2706,3 +2706,14 @@ fn parse_json_table() {
}
);
}
+
+#[test]
+fn test_group_concat() {
+ // examples taken from mysql docs
+ // https://dev.mysql.com/doc/refman/8.0/en/... | feat: Support Mysql GROUP_CONCAT
https://dev.mysql.com/doc/refman/8.3/en/aggregate-functions.html#function_group-concat
```sql
GROUP_CONCAT([DISTINCT] expr [,expr ...]
[ORDER BY {unsigned_integer | col_name | expr}
[ASC | DESC] [,col_name ...]]
[SEPARATOR str_val])
```... | 5ed13b5af3e87c88cce6b26c6ae0475cc84cdfd2 | [
"test_group_concat"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::tests::test_interval_display",
"ast::tests::test_cube_display",
"ast::tests::test_grouping_sets_display",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::tests::test_rollup_display",
"ast::tests::test... | [] | [] | |
0b5722afbfb60c3e3a354bc7c7dc02cb7803b807 | diff --git a/src/parser/mod.rs b/src/parser/mod.rs
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -6576,7 +6576,7 @@ impl<'a> Parser<'a> {
))))
}
}
- Keyword::STRUCT if dialect_of!(self is BigQueryDialect) => {
+ Keyword::S... | apache__datafusion-sqlparser-rs-1241 | 1,241 | [
"1240"
] | 0.45 | apache/datafusion-sqlparser-rs | 2024-04-28T10:56:42Z | diff --git a/tests/sqlparser_bigquery.rs b/tests/sqlparser_bigquery.rs
--- a/tests/sqlparser_bigquery.rs
+++ b/tests/sqlparser_bigquery.rs
@@ -350,7 +350,7 @@ fn parse_create_table_with_options() {
#[test]
fn parse_nested_data_types() {
let sql = "CREATE TABLE table (x STRUCT<a ARRAY<INT64>, b BYTES(42)>, y ARRA... | Support Struct datatype parsing for GenericDialect
Current BigQueryDialect is capable of parsing struct data type such as
```
create table t (s struct<n int, s varchar>);
```
According to [README](https://github.com/sqlparser-rs/sqlparser-rs/tree/0b5722afbfb60c3e3a354bc7c7dc02cb7803b807?tab=readme-ov-file#new-synta... | 0b5722afbfb60c3e3a354bc7c7dc02cb7803b807 | [
"parse_invalid_brackets",
"parse_nested_data_types",
"parse_typed_struct_syntax_bigquery_and_generic"
] | [
"ast::tests::test_cube_display",
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_interval_display",
"ast::tests::test_window_frame_default",
"ast::tests... | [] | [] | |
929c646bba9cdef6bf774b53bae0c19e0798ef2d | diff --git a/src/ast/mod.rs b/src/ast/mod.rs
--- a/src/ast/mod.rs
+++ b/src/ast/mod.rs
@@ -559,13 +559,18 @@ pub enum Expr {
/// ```sql
/// SUBSTRING(<expr> [FROM <expr>] [FOR <expr>])
/// ```
+ /// or
+ /// ```sql
+ /// SUBSTRING(<expr>, <expr>, <expr>)
+ /// ```
Substring {
ex... | apache__datafusion-sqlparser-rs-1173 | 1,173 | Perhaps https://github.com/sqlparser-rs/sqlparser-rs/issues/914 is related, and the easiest fix is probably to add this to `src/dialect/sqlite.rs`
```
fn supports_substring_from_for_expr(&self) -> bool {
false
}
```
See https://github.com/sqlparser-rs/sqlparser-rs/pull/947/files#diff-6f6a082c3... | [
"1168"
] | 0.44 | apache/datafusion-sqlparser-rs | 2024-03-13T11:13:27Z | diff --git a/src/dialect/mod.rs b/src/dialect/mod.rs
--- a/src/dialect/mod.rs
+++ b/src/dialect/mod.rs
@@ -325,10 +321,6 @@ mod tests {
self.0.supports_group_by_expr()
}
- fn supports_substring_from_for_expr(&self) -> bool {
- self.0.supports_substring_from_for_... | SUBSTRING function calls are always formatted as ` SUBSTRING(... FROM ... FOR ...)`
Parsing the following valid SQLite statement:
```sql
select substring('xxx', 1, 2)
```
then dumping the parsed result as sql results in the following syntax, which is invalid in SQLite:
```sql
select SUBSTRING('xxx' FROM 1 F... | 44727891713114b72546facf21a335606380845a | [
"parse_substring",
"parse_substring_in_select"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::tests::test_interval_display",
"ast::tests::test_cube_display",
"ast::tests::test_window_frame_default",
"ast::tests::test_grouping_sets_display",
"ast::tests... | [] | [] |
3ec337ec5f44bbb406c5806cb98643403f196fd2 | diff --git a/src/parser/mod.rs b/src/parser/mod.rs
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -8470,11 +8470,24 @@ impl<'a> Parser<'a> {
})
}
+ fn parse_pragma_value(&mut self) -> Result<Value, ParserError> {
+ match self.parse_value()? {
+ v @ Value::SingleQuotedString(_) =... | apache__datafusion-sqlparser-rs-1101 | 1,101 | [
"1100"
] | 0.41 | apache/datafusion-sqlparser-rs | 2024-01-18T06:25:38Z | diff --git a/tests/sqlparser_sqlite.rs b/tests/sqlparser_sqlite.rs
--- a/tests/sqlparser_sqlite.rs
+++ b/tests/sqlparser_sqlite.rs
@@ -70,6 +70,54 @@ fn pragma_funciton_style() {
}
}
+#[test]
+fn pragma_eq_string_style() {
+ let sql = "PRAGMA table_info = 'sqlite_master'";
+ match sqlite_and_generic().ver... | Support sqlite PRAGMA statements with string values
Hi, first of all, thank you for the amazing project.
I'm working on a DB client and need the ability to parse such statements:
```
PRAGMA table_info("sqlite_master")
PRAGMA table_info = "sqlite_master"
```
Which can be parsed and passed to SQLite on other DB c... | 3ec337ec5f44bbb406c5806cb98643403f196fd2 | [
"pragma_eq_string_style",
"pragma_function_string_style"
] | [
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::tests::test_window_frame_default",
"dialect::tests::test_is_dialect",
"dialect::tests::test_dialect_from_str",
"parser::tests::mysql_parse_index_table_constraint",
"parser::tests::test_mysql_partition_selection",
"parser::tests::... | [] | [] | |
885aa93465d0f984f4ff55cdff67f1be84472dc8 | diff --git a/src/ast/data_type.rs b/src/ast/data_type.rs
--- a/src/ast/data_type.rs
+++ b/src/ast/data_type.rs
@@ -373,6 +373,10 @@ pub enum DataType {
///
/// [postgresql]: https://www.postgresql.org/docs/current/plpgsql-trigger.html
Trigger,
+ /// Any data type, used in BigQuery UDF definitions for ... | apache__datafusion-sqlparser-rs-1602 | 1,602 | Jus adding to the context that is is working in BigQuery - see screenshot:
<img width="1126" alt="Screenshot 2024-12-13 at 16 16 57" src="https://github.com/user-attachments/assets/a73cf6d4-4bfe-4940-ac54-910c64d42382" />
| [
"1601"
] | 0.53 | apache/datafusion-sqlparser-rs | 2024-12-13T15:00:01Z | diff --git a/tests/sqlparser_bigquery.rs b/tests/sqlparser_bigquery.rs
--- a/tests/sqlparser_bigquery.rs
+++ b/tests/sqlparser_bigquery.rs
@@ -2212,3 +2212,19 @@ fn test_any_value() {
bigquery_and_generic().verified_expr("ANY_VALUE(fruit HAVING MAX sold)");
bigquery_and_generic().verified_expr("ANY_VALUE(frui... | Fails to parse BigQuery UDF with "ANY TYPE" parameters
EDIT: The "proper" name for this pattern is "Templated, SQL UDF Parameters", which can be further elaborated in the BQ Docs: https://cloud.google.com/bigquery/docs/user-defined-functions#templated-sql-udf-parameters
trying to parse this simple function like this... | 885aa93465d0f984f4ff55cdff67f1be84472dc8 | [
"test_any_type"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::spans::tests::test_join",
"ast::spans::tests::test_cte",
"ast::tests::test_cube_display",
"ast::tests::test_interval_display",
"ast::tests::test_grouping_sets... | [] | [] |
e16b24679a1e87dd54ce9565e87e818dce4d4a0a | diff --git a/src/ast/mod.rs b/src/ast/mod.rs
--- a/src/ast/mod.rs
+++ b/src/ast/mod.rs
@@ -2943,6 +2943,7 @@ pub enum Statement {
StartTransaction {
modes: Vec<TransactionMode>,
begin: bool,
+ transaction: Option<BeginTransactionKind>,
/// Only for SQLite
modifier: Option... | apache__datafusion-sqlparser-rs-1565 | 1,565 | [
"1553"
] | 0.52 | apache/datafusion-sqlparser-rs | 2024-11-28T01:15:56Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -7736,9 +7736,9 @@ fn parse_start_transaction() {
}
verified_stmt("START TRANSACTION");
- one_statement_parses_to("BEGIN", "BEGIN TRANSACTION");
- one_statement_parses_... | `BEGIN;` is formatted as `BEGIN TRANSACTION;`, which is invalid in MySQL
`BEGIN;` is valid in MySQL, but not `BEGIN TRANSACTION;`: https://dev.mysql.com/doc/refman/8.4/en/commit.html
But sqlparser does not preserve the exact syntax of the statement, and always formats it as `BEGIN TRANSACTION;`, causing an executio... | e16b24679a1e87dd54ce9565e87e818dce4d4a0a | [
"parse_start_transaction",
"parse_begin_without_transaction",
"parse_start_transaction_with_modifier"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::spans::tests::test_join",
"ast::spans::tests::test_cte",
"ast::tests::test_interval_display",
"ast::tests::test_one_or_many_with_parens_as_ref",
"ast::tests::... | [] | [] | |
3c8fd748043188957d2dfcadb4bfcfb0e1f70c82 | diff --git a/derive/README.md b/derive/README.md
--- a/derive/README.md
+++ b/derive/README.md
@@ -151,6 +151,55 @@ visitor.post_visit_expr(<is null operand>)
visitor.post_visit_expr(<is null expr>)
```
+If the field is a `Option` and add `#[with = "visit_xxx"]` to the field, the generated code
+will try to access ... | apache__datafusion-sqlparser-rs-1556 | 1,556 | I think the reason is we changed the table name to `Option<ObjectName>` in https://github.com/apache/datafusion-sqlparser-rs/pull/1501 but the visitor can only recognize the `ObjectName`. 🤔
https://github.com/apache/datafusion-sqlparser-rs/blob/525d1780e8f5c7ba6b7be327eaa788b6c8c47716/src/ast/mod.rs#L7587-L7590
Than... | [
"1554"
] | 0.52 | apache/datafusion-sqlparser-rs | 2024-11-26T14:02:44Z | diff --git a/src/ast/visitor.rs b/src/ast/visitor.rs
--- a/src/ast/visitor.rs
+++ b/src/ast/visitor.rs
@@ -876,7 +876,16 @@ mod tests {
"POST: QUERY: SELECT * FROM monthly_sales PIVOT(SUM(a.amount) FOR a.MONTH IN ('JAN', 'FEB', 'MAR', 'APR')) AS p (c, d) ORDER BY EMPID",
"POST:... | Relation visitor fails to visit the `SHOW COLUMNS` statement in the latest commit of the main branch
# Description
This problem can be reproduced by adding a test case at
https://github.com/apache/datafusion-sqlparser-rs/blob/525d1780e8f5c7ba6b7be327eaa788b6c8c47716/src/ast/visitor.rs#L736-L738
Consider a case
``... | e16b24679a1e87dd54ce9565e87e818dce4d4a0a | [
"ast::visitor::tests::test_sql"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::spans::tests::test_join",
"ast::spans::tests::test_snowflake_lateral_flatten",
"ast::spans::tests::test_subquery",
"ast::spans::tests::test_cte",
"ast::tests:... | [] | [] |
813f4a2eff8f091b643058ac1a46a4fbffd96806 | diff --git a/src/ast/value.rs b/src/ast/value.rs
--- a/src/ast/value.rs
+++ b/src/ast/value.rs
@@ -91,6 +91,8 @@ pub enum DateTimeField {
Millennium,
Millisecond,
Milliseconds,
+ Nanosecond,
+ Nanoseconds,
Quarter,
Timezone,
TimezoneHour,
diff --git a/src/ast/value.rs b/src/ast/value... | apache__datafusion-sqlparser-rs-749 | 749 | [
"748"
] | 0.28 | apache/datafusion-sqlparser-rs | 2022-12-06T10:06:35Z | diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -1740,6 +1740,9 @@ fn parse_extract() {
verified_stmt("SELECT EXTRACT(HOUR FROM d)");
verified_stmt("SELECT EXTRACT(MINUTE FROM d)");
verified_stmt("SELECT EXTRACT(SECOND ... | support keyword `NANOSECOND`
i'd like to add a new keyword `NANOSECOND` so that we could parse something likes
`SELECT EXTRACT(NANOSECOND FROM d)`
| 0c9ec4008269dde77a4a5895b0a69a0a27c40ca3 | [
"parse_extract"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"parser::tests::test_parse_data_type::test_ansii_character_large_object_types",
"dialect::tests::test_is_dialect",
"ast::tests::test_cube_display",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"parser::tests::te... | [] | [] | |
6b2b3f1f6c903bddc87ba0858b5ccdb94c5e2242 | diff --git a/src/dialect/mysql.rs b/src/dialect/mysql.rs
--- a/src/dialect/mysql.rs
+++ b/src/dialect/mysql.rs
@@ -18,8 +18,8 @@ pub struct MySqlDialect {}
impl Dialect for MySqlDialect {
fn is_identifier_start(&self, ch: char) -> bool {
// See https://dev.mysql.com/doc/refman/8.0/en/identifiers.html.
- ... | apache__datafusion-sqlparser-rs-856 | 856 | Althrough nodody would name their columns like `1col` `00column`, mysql does allow this.
```bash
CREATE DATABASE test;
use test;
CREATE TABLE my_table (
id int,
1col int,
2col int
);
INSERT INTO my_table VALUES (1,2,3);
INSERT INTO my_table VALUES (2,3,4);
INSERT INTO my_table VALUES (3,4,5);
S... | [
"804"
] | 0.33 | apache/datafusion-sqlparser-rs | 2023-04-24T10:14:20Z | diff --git a/tests/sqlparser_mysql.rs b/tests/sqlparser_mysql.rs
--- a/tests/sqlparser_mysql.rs
+++ b/tests/sqlparser_mysql.rs
@@ -849,6 +849,106 @@ fn parse_insert_with_on_duplicate_update() {
}
}
+#[test]
+fn parse_select_with_numeric_prefix_column_name() {
+ let sql = "SELECT 123col_$@123abc FROM \"table\... | Incorrect parsing literals that consisting of digits and letters, beginning with digits
It seems when parsing a literal beginning with digits, the sql parser simply ends this token when meets a non-numeric character
see https://github.com/sqlparser-rs/sqlparser-rs/blob/main/src/tokenizer.rs#L547
For example, `123... | 097e7ad56ed09e5757fbf0719d07194aa93521e8 | [
"parse_insert_with_numeric_prefix_column_name",
"parse_select_with_numeric_prefix_column_name"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_rollup_display",
"ast::tests::test_cube_display",
"dialect::tests::test_is_dialect",
"ast::tests::test_w... | [] | [] |
86d71f21097c0a44e67cc1513466c573ac1f763c | diff --git a/src/parser.rs b/src/parser.rs
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -1433,7 +1433,7 @@ impl<'a> Parser<'a> {
///
/// [(1)]: Expr::MatchAgainst
pub fn parse_match_against(&mut self) -> Result<Expr, ParserError> {
- let columns = self.parse_parenthesized_column_list(Mandatory)?;
+ ... | apache__datafusion-sqlparser-rs-783 | 783 | [
"624"
] | 0.29 | apache/datafusion-sqlparser-rs | 2023-01-01T10:51:46Z | diff --git a/tests/sqlparser_mysql.rs b/tests/sqlparser_mysql.rs
--- a/tests/sqlparser_mysql.rs
+++ b/tests/sqlparser_mysql.rs
@@ -692,6 +692,41 @@ fn parse_simple_insert() {
}
}
+#[test]
+fn parse_empty_row_insert() {
+ let sql = "INSERT INTO tb () VALUES (), ()";
+
+ match mysql().one_statement_parses_t... | Support MySQL's empty row insert
MySQL supports default row inserts [1], which we don't, like:
```sql
INSERT INTO tb () VALUES ();
```
This returns: `ParserError("Expected identifier, found: )")`
Maybe the columns list could be an option, instead of a vector? This way we can differentiate between non-existen... | 86d71f21097c0a44e67cc1513466c573ac1f763c | [
"parse_empty_row_insert"
] | [
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::tests::test_cube_display",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_rollup_display",
"ast::tests::test_window_frame_default",
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"dialect::tes... | [] | [] | |
0c9ec4008269dde77a4a5895b0a69a0a27c40ca3 | diff --git a/src/parser.rs b/src/parser.rs
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -4693,21 +4693,24 @@ impl<'a> Parser<'a> {
format = Some(self.parse_analyze_format()?);
}
- if let Some(statement) = self.maybe_parse(|parser| parser.parse_statement()) {
- Ok(Statement::Expla... | apache__datafusion-sqlparser-rs-781 | 781 | [
"744"
] | 0.28 | apache/datafusion-sqlparser-rs | 2022-12-29T02:03:40Z | diff --git a/src/parser.rs b/src/parser.rs
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -7138,4 +7141,16 @@ mod tests {
))
);
}
+
+ #[test]
+ fn test_nested_explain_error() {
+ let sql = "EXPLAIN EXPLAIN SELECT 1";
+ let ast = Parser::parse_sql(&GenericDialect, sql);
+ ... | Return an error when the SQL query contains nested `Explain`
In datafusion, we met a bug (https://github.com/apache/arrow-datafusion/issues/4378) which the datafusion-CLI will panic when the query contains nested `EXPLAIN`.
We fixed this bug using a workaround way, and currently the datafusion will return an `Intern... | 0c9ec4008269dde77a4a5895b0a69a0a27c40ca3 | [
"parser::tests::test_nested_explain_error"
] | [
"ast::helpers::stmt_create_table::tests::test_from_valid_statement",
"ast::helpers::stmt_create_table::tests::test_from_invalid_statement",
"ast::tests::test_cube_display",
"ast::tests::test_grouping_sets_display",
"ast::tests::test_rollup_display",
"ast::tests::test_window_frame_default",
"dialect::tes... | [] | [] | |
beb700f88974420d36cad494b1fac80de3e01093 | diff --git a/src/paint.rs b/src/paint.rs
--- a/src/paint.rs
+++ b/src/paint.rs
@@ -1,5 +1,3 @@
-use lazy_static::lazy_static;
-use regex::Regex;
use std::io::Write;
use itertools::Itertools;
diff --git a/src/paint.rs b/src/paint.rs
--- a/src/paint.rs
+++ b/src/paint.rs
@@ -586,18 +584,26 @@ fn style_sections_contai... | dandavison__delta-425 | 425 | I guess it *is* a whitespace ~error~ diff, since newlines are whitespace, no ?
It's very distracting having it highlighted in the middle of a block, and it's inconsistent with what `git` itself highlights as whitespace errors:
;
}
+ #[test]
+ fn test_added_empty_line_is_not_whitespace_error() {
+ let plus_style... | 🐛 Empty lines highlight plus-marker as whitespace-error
With a test file:
```
No Spaces
Spaces
```
(Note that there are spaces on the last line)
Running
```
delta --no-gitconfig --keep-plus-minus-markers <(echo -n) test-file
```
highlights the plus-marker on the empty line as a whitespace err... | 5e39a0e4dde2e010b13cb0d9cf01212e6910de4f | [
"tests::test_example_diffs::tests::test_added_empty_line_is_not_whitespace_error"
] | [
"align::tests::test_0",
"align::tests::test_0_nonascii",
"align::tests::test_1",
"align::tests::test_run_length_encode",
"align::tests::test_2",
"ansi::console_tests::tests::test_text_width",
"ansi::console_tests::tests::test_truncate_str",
"ansi::console_tests::tests::test_truncate_str_no_ansi",
"a... | [] | [] |
f52464c1af557a5759566a988d2478ccb6e86d3e | diff --git a/src/cli.rs b/src/cli.rs
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -437,6 +437,10 @@ pub struct Opt {
/// Text to display in front of a added file path.
pub file_added_label: String,
+ #[structopt(long = "file-copied-label", default_value = "copied:")]
+ /// Text to display in front of a copied... | dandavison__delta-403 | 403 | Hi @phil-blain, thanks for this, I didn't know about the feature. | [
"392"
] | 0.4 | dandavison/delta | 2020-11-23T01:30:11Z | diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs
--- a/src/tests/test_example_diffs.rs
+++ b/src/tests/test_example_diffs.rs
@@ -46,6 +46,17 @@ mod tests {
));
}
+ #[test]
+ fn test_copied_file() {
+ let config = integration_test_utils::make_config_from_args(&[... | 🚀 delta does not recognize Git's copy detection
Git has special flags and configuration variables for `git log`, `git show`, `git diff`, `git diff-tree`, `git diff-index`, `git diff-tree`, and `git format-patch` to detect copies as well as renames.
These add "copy from"/"copy to" lines in the diff header when ... | 5e39a0e4dde2e010b13cb0d9cf01212e6910de4f | [
"tests::test_example_diffs::tests::test_copied_file"
] | [
"align::tests::test_0",
"align::tests::test_1",
"align::tests::test_0_nonascii",
"align::tests::test_2",
"align::tests::test_run_length_encode",
"ansi::console_tests::tests::test_text_width",
"ansi::iterator::tests::test_iterator_1",
"ansi::console_tests::tests::test_truncate_str_no_ansi",
"ansi::it... | [] | [] |
759f484955f674bf000d1ae4bab8c7cb1f453ab2 | diff --git a/src/delta.rs b/src/delta.rs
--- a/src/delta.rs
+++ b/src/delta.rs
@@ -380,9 +380,6 @@ fn handle_hunk_header_line(
plus_file: &str,
config: &Config,
) -> std::io::Result<()> {
- if config.hunk_header_style.is_omitted {
- return Ok(());
- }
let decoration_ansi_term_style;
le... | dandavison__delta-323 | 323 | Hi @Minnozz, thanks for this, very helpful. Clearly the test suite needs to be strengthened for `git add -p` also. I know `git add -p` is important, so this is probably the top priority for delta bugs right now.
Hi @dandavison, let me know if you need more information.
I looked for causes of this bug before, and
``... | [
"320",
"293"
] | 0.4 | dandavison/delta | 2020-09-16T23:05:16Z | diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs
--- a/src/tests/test_example_diffs.rs
+++ b/src/tests/test_example_diffs.rs
@@ -831,6 +831,50 @@ src/align.rs
);
}
+ #[test]
+ fn test_color_only_output_is_in_one_to_one_correspondence_with_input() {
+ _do_test_o... | 🐛 git add -p one-to-one correspondence errors
When I try to use `git add -p`, I get the following error:
```
$ git add -p
fatal: mismatched output from interactive.diffFilter
hint: Your filter must maintain a one-to-one correspondence
hint: between its input and output lines.
```
I'm using `delta` with the fo... | 5e39a0e4dde2e010b13cb0d9cf01212e6910de4f | [
"tests::test_example_diffs::tests::test_color_only_output_is_in_one_to_one_correspondence_with_input"
] | [
"align::tests::test_2",
"align::tests::test_0",
"align::tests::test_0_nonascii",
"align::tests::test_1",
"align::tests::test_run_length_encode",
"ansi::console_tests::tests::test_text_width",
"ansi::console_tests::tests::test_truncate_str",
"ansi::iterator::tests::test_iterator_1",
"ansi::console_te... | [] | [] |
218af1617f512b06bb1a7f52a15510fe56c5de80 | diff --git a/src/handlers/diff_header.rs b/src/handlers/diff_header.rs
--- a/src/handlers/diff_header.rs
+++ b/src/handlers/diff_header.rs
@@ -374,7 +374,11 @@ fn remove_surrounding_quotes(path: &str) -> &str {
}
}
-fn _parse_file_path(s: &str, git_diff_name: bool) -> String {
+fn _parse_file_path(path: &str, g... | dandavison__delta-1840 | 1,840 | [
"1821"
] | 0.18 | dandavison/delta | 2024-09-02T21:16:56Z | diff --git a/src/handlers/diff_header.rs b/src/handlers/diff_header.rs
--- a/src/handlers/diff_header.rs
+++ b/src/handlers/diff_header.rs
@@ -638,6 +640,10 @@ mod tests {
"diff --git a/.config/Code - Insiders/User/settings.json b/.config/Code - Insiders/User/settings.json"),
Some(".config... | 🐛 Changes in files with non-Latin names incorrectly imply these files being renamed
When the name of a changed file contains non-Latin characters, `delta` shows it as renamed instead of just the contents being changed.
To reproduce:
```
$ git init
$ echo one > привет.txt; echo three > hello.txt
$ git add .
$... | 1dd28e7b51a913fc28eefc59d01f3b78f1146850 | [
"handlers::diff_header::tests::test_get_repeated_file_path_from_diff_line"
] | [
"align::tests::test_0",
"align::tests::test_2",
"align::tests::test_1",
"align::tests::test_3",
"align::tests::test_0_nonascii",
"align::tests::test_5",
"align::tests::test_4",
"align::tests::test_6",
"align::tests::test_run_length_encode",
"ansi::console_tests::tests::test_text_width",
"ansi::c... | [] | [] | |
738c5a141bf86d3e05aa348eb87df78c36a72337 | diff --git a/manual/src/full---help-output.md b/manual/src/full---help-output.md
--- a/manual/src/full---help-output.md
+++ b/manual/src/full---help-output.md
@@ -1,7 +1,7 @@
# Full --help output
```
-delta 0.12.1
+delta 0.13.0
A viewer for git and diff output
USAGE:
diff --git a/manual/src/full---help-output.m... | dandavison__delta-1158 | 1,158 | Hi @mliszcz, thanks! I agree with the feature proposal and I think that your proposed API is spot-on. Please do go ahead and make a PR if you have time, and let me know if anything's unclear about the development workflow. | [
"1157"
] | 0.13 | dandavison/delta | 2022-08-11T23:11:31Z | diff --git a/manual/src/full---help-output.md b/manual/src/full---help-output.md
--- a/manual/src/full---help-output.md
+++ b/manual/src/full---help-output.md
@@ -49,6 +49,13 @@ OPTIONS:
[default: "%Y-%m-%d %H:%M:%S %z"]
+ --blame-timestamp-output-format <FMT>
+ Format str... | 🚀 Configurable timestamp output format in git blame
In git blame I noticed this:

It would be helpful to know e.g. which change was applied first but this can not be figured out from the humanized timestam... | 738c5a141bf86d3e05aa348eb87df78c36a72337 | [
"config::tests::test_get_computed_values_from_config",
"features::diff_so_fancy::tests::test_diff_so_fancy_respects_git_config",
"features::hyperlinks::tests::test_paths_and_hyperlinks_user_in_repo_root_dir",
"features::diff_highlight::test_utils::test_diff_highlight_respects_gitconfig",
"features::diff_so_... | [
"align::tests::test_0_nonascii",
"align::tests::test_0",
"align::tests::test_2",
"align::tests::test_1",
"align::tests::test_run_length_encode",
"ansi::console_tests::tests::test_text_width",
"ansi::console_tests::tests::test_truncate_str",
"ansi::console_tests::tests::test_truncate_str_no_ansi",
"a... | [] | [] |
3f527e0d9c6100119c86a5cd4adb21f3c51651c6 | diff --git a/src/handlers/commit_meta.rs b/src/handlers/commit_meta.rs
--- a/src/handlers/commit_meta.rs
+++ b/src/handlers/commit_meta.rs
@@ -16,6 +16,7 @@ impl<'a> StateMachine<'a> {
}
let mut handled_line = false;
self.painter.paint_buffered_minus_and_plus_lines();
+ self.handle_pen... | dandavison__delta-1111 | 1,111 | Thanks very much @dotdash, this looks like a rather bad bug. (Sorry to be slow replying, I was on holiday, and a bit consumed by the day job).
I believe I'm observing likely the same issue but after mode modification. It appears to affect last file only.
Note that without `-p` all files are correctly placed:
```
c... | [
"1089"
] | 0.13 | dandavison/delta | 2022-06-21T18:07:24Z | diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs
--- a/src/tests/test_example_diffs.rs
+++ b/src/tests/test_example_diffs.rs
@@ -1626,6 +1626,13 @@ src/align.rs:71: impl<'a> Alignment<'a> { │
.expect_contains("a b ⟶ c d\n");
}
+ #[test]
+ fn test_file_removal_in... | 🐛 File removal attributed to wrong commit in `git log`
When viewing more than one commit, file removals are shown on the wrong commit.
Raw log from `git log -p | "cat"`:
```
commit 166ed1d1c00715eb111a7d5938f2efc43f2f7c08
Author: Björn Steinbrink <b.steinbrink@demv.de>
Date: Mon May 30 12:19:21 2022 +0200
... | 738c5a141bf86d3e05aa348eb87df78c36a72337 | [
"tests::test_example_diffs::tests::test_file_removal_in_log_output"
] | [
"align::tests::test_0_nonascii",
"align::tests::test_0",
"align::tests::test_1",
"align::tests::test_2",
"align::tests::test_run_length_encode",
"ansi::console_tests::tests::test_text_width",
"ansi::console_tests::tests::test_truncate_str",
"ansi::console_tests::tests::test_truncate_str_no_ansi",
"a... | [] | [] |
f556db8d4edac47c6b053191f02568969a14f06a | diff --git a/src/handlers/grep.rs b/src/handlers/grep.rs
--- a/src/handlers/grep.rs
+++ b/src/handlers/grep.rs
@@ -222,17 +222,19 @@ fn get_code_style_sections<'b>(
non_match_style: Style,
grep: &GrepLine,
) -> Option<StyleSectionSpecifier<'b>> {
- if let Some(raw_code_start) = ansi::ansi_preserving_index... | dandavison__delta-1057 | 1,057 | [
"1056"
] | 0.13 | dandavison/delta | 2022-04-25T23:55:59Z | diff --git a/src/handlers/grep.rs b/src/handlers/grep.rs
--- a/src/handlers/grep.rs
+++ b/src/handlers/grep.rs
@@ -900,4 +902,60 @@ mod tests {
let apparently_grep_output = "src/co-7-fig.rs:xxx";
assert_eq!(parse_grep_line(apparently_grep_output), None);
}
+
+ #[test]
+ fn test_get_code_sty... | 🐛 `git grep` handler doesn't highlight matches that start in column 0
Hi! It looks like the `git grep` handler can't highlight the grep-match if the grep-match starts at the beginning of the line of code. I'm not sure if this is always the case or if it's specific to my type of terminal in some way (I'm using Terminal... | 738c5a141bf86d3e05aa348eb87df78c36a72337 | [
"handlers::grep::tests::test_get_code_style_sections"
] | [
"align::tests::test_0",
"align::tests::test_0_nonascii",
"align::tests::test_1",
"align::tests::test_2",
"align::tests::test_run_length_encode",
"ansi::console_tests::tests::test_text_width",
"ansi::console_tests::tests::test_truncate_str",
"ansi::iterator::tests::test_iterator_1",
"ansi::iterator::... | [] | [] | |
32138d031ec2bc42bc856f7a9b3367729256781c | diff --git a/src/handlers/hunk_header.rs b/src/handlers/hunk_header.rs
--- a/src/handlers/hunk_header.rs
+++ b/src/handlers/hunk_header.rs
@@ -29,7 +29,7 @@ use crate::config::Config;
use crate::delta::{self, State, StateMachine};
use crate::features;
use crate::paint::Painter;
-use crate::style::{DecorationStyle, S... | dandavison__delta-710 | 710 | Hi @ynavott, thanks for this. Can you post the delta config that produces this behavior please?
I am currently on vacation in the highlands of Iceland at the moment and don't have very good reception most of the time, will try to send you the exact config as soon as possible.
> Hi @ynavott, thanks for this. Can you pos... | [
"672"
] | 0.8 | dandavison/delta | 2021-09-02T14:22:42Z | diff --git a/src/handlers/hunk_header.rs b/src/handlers/hunk_header.rs
--- a/src/handlers/hunk_header.rs
+++ b/src/handlers/hunk_header.rs
@@ -354,4 +351,19 @@ pub mod tests {
assert_eq!(result, "");
}
+
+ #[test]
+ fn test_get_painted_file_with_line_number_empty_navigate() {
+ let cfg = in... | 🐛 Hunk header prints ":" with no file or line number, even when hyperlinks are off
This issue relates to the bug already discussed in #650. Since then. It was probably broken again by some newer commits. To demonstrate:
);
}
+ self.painter.paint_buffered_minus_and_plus_lines();
// In color_only mode, raw_line... | dandavison__delta-1003 | 1,003 | [
"1002"
] | 0.12 | dandavison/delta | 2022-03-07T13:24:46Z | diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs
--- a/src/tests/test_example_diffs.rs
+++ b/src/tests/test_example_diffs.rs
@@ -135,6 +135,15 @@ mod tests {
);
}
+ #[test]
+ fn test_diff_unified_concatenated() {
+ // See #1002. Line buffers were not being flus... | 🐛 Misplaced diff output
I had occasion to concatenate the `diff -u` output for several files into a single file and noticed that using delta to page the input stream misplaced a trailing chunk from one file into the start of the next file. A simple example input that reproduces the issue:
```text
--- 1/x 2022-03-... | fd3770875be43b28aed72adc7b3fec44d5a7a80d | [
"tests::test_example_diffs::tests::test_diff_unified_concatenated"
] | [
"align::tests::test_0",
"ansi::console_tests::tests::test_truncate_str",
"ansi::console_tests::tests::test_text_width",
"align::tests::test_1",
"align::tests::test_2",
"align::tests::test_0_nonascii",
"ansi::console_tests::tests::test_truncate_str_no_ansi",
"ansi::iterator::tests::test_iterator_2",
... | [] | [] | |
32e15ce6fb3cbc9648f189f197206ab29aa329c4 | diff --git a/src/handlers/grep.rs b/src/handlers/grep.rs
--- a/src/handlers/grep.rs
+++ b/src/handlers/grep.rs
@@ -345,7 +345,7 @@ fn make_grep_line_regex(regex_variant: GrepLineRegex) -> Regex {
( # 1. file name (colons not allowed)
[^:|\ ] # try to be stric... | dandavison__delta-975 | 975 | [
"974"
] | 0.12 | dandavison/delta | 2022-02-19T16:26:25Z | diff --git a/src/handlers/grep.rs b/src/handlers/grep.rs
--- a/src/handlers/grep.rs
+++ b/src/handlers/grep.rs
@@ -655,6 +655,24 @@ mod tests {
);
}
+ #[test]
+ fn test_parse_grep_n_match_directory_name_with_dashes() {
+ let fake_parent_grep_command =
+ "/usr/local/bin/git --does... | 🐛 `git grep` output parsed, printed incorrectly for .properties files with hyphen in path
When I `git grep` for something that's found in a `.properties` file whose directory name contains a hyphen, I get bad results. The highlighting is wrong on the matching line, and the filename itself is incorrect - the hyphen wi... | fd3770875be43b28aed72adc7b3fec44d5a7a80d | [
"handlers::grep::tests::test_parse_grep_n_match_directory_name_with_dashes"
] | [
"align::tests::test_0_nonascii",
"align::tests::test_0",
"align::tests::test_2",
"align::tests::test_1",
"ansi::console_tests::tests::test_text_width",
"align::tests::test_run_length_encode",
"ansi::console_tests::tests::test_truncate_str",
"ansi::console_tests::tests::test_truncate_str_no_ansi",
"a... | [] | [] | |
5ece1944f1a7df30d342452d7a85d4871c16a42c | diff --git a/src/delta.rs b/src/delta.rs
--- a/src/delta.rs
+++ b/src/delta.rs
@@ -62,7 +62,9 @@ struct StateMachine<'a> {
source: Source,
minus_file: String,
plus_file: String,
- file_event: parse::FileEvent,
+ minus_file_event: parse::FileEvent,
+ plus_file_event: parse::FileEvent,
+ file_p... | dandavison__delta-605 | 605 | I am running into the same problem. Forwarding the plaintext would be sufficient, I would personally prefer a more human readable option of
```
old mode rw-r--r--
new mode rwxr-xr-x
```
similar to `ls -l` (or colored like `exa -l` ), and finally I expect people would like only a diff variant similar to `chmod u+x`... | [
"583"
] | 0.7 | dandavison/delta | 2021-05-20T02:23:34Z | diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs
--- a/src/tests/test_example_diffs.rs
+++ b/src/tests/test_example_diffs.rs
@@ -1569,6 +1569,14 @@ src/align.rs:71: impl<'a> Alignment<'a> { │
));
}
+ #[test]
+ fn test_file_mode_change() {
+ let config = integra... | 🐛 No output for chmod file mode change
There is no output shown for file mode change (add/remove execute bit). I've tested using delta 0.7.1, with my custom style configuration as well as the default style (empty delta section in effective `.gitconfig`). Examples of raw git output is shown below, for both for both a m... | 6be96be6b9af9ababc67835a35d8685d2fc6867d | [
"tests::test_example_diffs::tests::test_file_mode_change"
] | [
"align::tests::test_0",
"align::tests::test_1",
"align::tests::test_0_nonascii",
"align::tests::test_2",
"ansi::console_tests::tests::test_truncate_str_no_ansi",
"ansi::console_tests::tests::test_text_width",
"ansi::console_tests::tests::test_truncate_str",
"ansi::iterator::tests::test_iterator_2",
... | [] | [] |
656a1f939d4854fc16295b472bb8d10a044aae47 | diff --git a/src/bat_utils/terminal.rs b/src/bat_utils/terminal.rs
--- a/src/bat_utils/terminal.rs
+++ b/src/bat_utils/terminal.rs
@@ -1,21 +1,48 @@
-extern crate ansi_colours;
-
-use ansi_term::Colour::{Fixed, RGB};
+use ansi_term::Color::{self, Fixed, RGB};
use ansi_term::{self, Style};
use syntect::highlighting:... | dandavison__delta-581 | 581 | I second that. I'm struggling with the same issue.
I don't care about the `delta` theme at all, I wish `delta` could just alternate between `--light` and `--dark` colors according to the terminal colors automatically.
Out of the curiosity, what terminal emulator are you using @tshu-w? Does it support this out-of... | [
"447"
] | 0.7 | dandavison/delta | 2021-04-29T21:12:25Z | diff --git a/src/parse_style.rs b/src/parse_style.rs
--- a/src/parse_style.rs
+++ b/src/parse_style.rs
@@ -334,8 +334,6 @@ mod tests {
use ansi_term;
- use crate::color::ansi_16_color_name_to_number;
-
#[test]
fn test_parse_ansi_term_style() {
assert_eq!(
diff --git a/src/parse_style.rs b... | 🚀 Use light/dark theme base on terminal theme or system variable.
Hi, I have set my terminal to auto change themes based on macOS appearance. It would be much appreciated if delta can use light/dark theme base on terminal theme or system variable.
| 6be96be6b9af9ababc67835a35d8685d2fc6867d | [
"parse_style::tests::test_decoration_style_from_str",
"parse_style::tests::test_parse_ansi_term_style",
"parse_style::tests::test_parse_ansi_term_style_with_special_omit_attribute",
"parse_style::tests::test_parse_ansi_term_style_with_special_raw_attribute",
"parse_style::tests::test_parse_ansi_term_style_w... | [
"align::tests::test_0_nonascii",
"align::tests::test_0",
"align::tests::test_2",
"align::tests::test_1",
"align::tests::test_run_length_encode",
"ansi::console_tests::tests::test_text_width",
"ansi::iterator::tests::test_iterator_2",
"ansi::iterator::tests::test_iterator_osc_hyperlinks_styled_non_asci... | [] | [] |
63fdebbf68878fa52fe178f0e5d2a89478345878 | diff --git a/src/git_config/git_config_entry.rs b/src/git_config/git_config_entry.rs
--- a/src/git_config/git_config_entry.rs
+++ b/src/git_config/git_config_entry.rs
@@ -23,7 +23,7 @@ lazy_static! {
static ref GITHUB_REMOTE_URL: Regex = Regex::new(
r"(?x)
^
- (?:https://|git@) # Support b... | dandavison__delta-668 | 668 | (Fwiw, if you deem this to a feature you want included in the first place, I'd be happy to submit a PR adding it if that's useful :)
Hi @spaarmann, we recently added this option:
```
--hyperlinks-commit-link-format <hyperlinks-commit-link-format>
Format string for commit hyperlinks (requires --hype... | [
"667"
] | 0.8 | dandavison/delta | 2021-07-26T11:43:15Z | diff --git a/src/git_config/git_config_entry.rs b/src/git_config/git_config_entry.rs
--- a/src/git_config/git_config_entry.rs
+++ b/src/git_config/git_config_entry.rs
@@ -62,6 +62,8 @@ mod tests {
"https://github.com/dandavison/delta",
"git@github.com:dandavison/delta.git",
"git@g... | 🚀 Show Github commit hyperlinks even if remote URL does not contain `git@`
Hi! I was recently a bit confused why hyperlinks for commits were working in some of my local clones but not others.
After a bit of investigation I've figured out that it's caused by the remote URL being simply `github.com:user/repo` instead o... | 80691898cd4cae02f40ed5ad6986e517a938d14f | [
"git_config::git_config_entry::tests::test_parse_github_urls"
] | [
"align::tests::test_0_nonascii",
"align::tests::test_1",
"align::tests::test_2",
"align::tests::test_0",
"align::tests::test_run_length_encode",
"ansi::console_tests::tests::test_text_width",
"ansi::console_tests::tests::test_truncate_str_no_ansi",
"ansi::console_tests::tests::test_truncate_str",
"a... | [] | [] |
faa743a6f1055705aa923911003cef6b1807e93e | diff --git a/crates/core/src/kernel/arrow/json.rs b/crates/core/src/kernel/arrow/json.rs
--- a/crates/core/src/kernel/arrow/json.rs
+++ b/crates/core/src/kernel/arrow/json.rs
@@ -62,9 +62,10 @@ pub(crate) fn parse_json(
for it in 0..json_strings.len() {
if json_strings.is_null(it) {
if value_... | delta-io__delta-rs-2405 | 2,405 | @yjshen can you add some reproducible code?
I've seen this error when trying to read an old table with 10s of thousands of partitions. I started removing old partitions and vacuum/compact and the error went away. Maybe the schema changed at some point or something wrong with the old data. I'm not sure. | [
"2312"
] | 1.0 | delta-io/delta-rs | 2024-04-10T02:48:43Z | diff --git a/crates/core/src/kernel/arrow/json.rs b/crates/core/src/kernel/arrow/json.rs
--- a/crates/core/src/kernel/arrow/json.rs
+++ b/crates/core/src/kernel/arrow/json.rs
@@ -148,3 +162,42 @@ pub(crate) fn decode_reader<'a, R: BufRead + 'a>(
};
std::iter::from_fn(move || next().map_err(DeltaTableError::fr... | Extract `add.stats_parsed` with wrong type
# Bug
During delta log reading, extracting `add.stats_parsed` with the wrong `StringArray` type (on line 82) results in a double `stats_parsed` column in the result batch.
https://github.com/delta-io/delta-rs/blob/eb8c19c404bc53e1e74ddbeb55f182c9e6804b74/crates/core/src/... | f2e30a0bbf58a3b56b2f912a02e10e7af0835301 | [
"kernel::arrow::json::tests::json_to_struct"
] | [
"data_catalog::client::backoff::tests::test_backoff",
"data_catalog::storage::tests::test_normalize_table_name",
"data_catalog::unity::models::tests::test_response_errors",
"data_catalog::unity::models::tests::test_responses",
"kernel::arrow::tests::test_arrow_from_delta_decimal_type_invalid_precision",
"... | [] | [] |
9d3ecbeb628db3d046d86429315aaf4765f6a41b | diff --git a/crates/core/src/operations/constraints.rs b/crates/core/src/operations/constraints.rs
--- a/crates/core/src/operations/constraints.rs
+++ b/crates/core/src/operations/constraints.rs
@@ -198,9 +198,10 @@ impl std::future::IntoFuture for ConstraintBuilder {
.build(Some(&this.snapshot), this.... | delta-io__delta-rs-2396 | 2,396 | Does this only manifest with the schema evolution? Or are you able to see errors with append or merge writes as well?
> Does this only manifest with the schema evolution? Or are you able to see errors with append or merge writes as well?
It happens at any operation when there is concurrency and the state gets update... | [
"2262"
] | 1.0 | delta-io/delta-rs | 2024-04-07T18:57:01Z | diff --git a/crates/core/tests/command_merge.rs b/crates/core/tests/command_merge.rs
--- a/crates/core/tests/command_merge.rs
+++ b/crates/core/tests/command_merge.rs
@@ -177,17 +177,7 @@ async fn test_merge_concurrent_different_partition() {
// TODO: Currently it throws a Version mismatch error, but the merge c... | Generic DeltaTable error: Version mismatch with new schema merge functionality in AWS S3
# Environment
**Delta-rs version**: python v0.16
**Binding**: ^^
**Environment**:
- **Cloud provider**: AWS s3 with dynamo
***
# Bug
**What happened**:
To test the rust engine, we cleared out any existing delta ... | f2e30a0bbf58a3b56b2f912a02e10e7af0835301 | [
"test_merge_concurrent_different_partition"
] | [
"test_merge_concurrent_with_overlapping_files",
"test_merge_concurrent_conflict"
] | [] | [] |
935a7187c273e0efc876d094d6247d50e28677a3 | diff --git a/src/buffer/buffer.rs b/src/buffer/buffer.rs
--- a/src/buffer/buffer.rs
+++ b/src/buffer/buffer.rs
@@ -192,7 +192,7 @@ impl Buffer {
}
/// Print at most the first n characters of a string if enough space is available
- /// until the end of the line.
+ /// until the end of the line. Skips z... | ratatui__ratatui-1226 | 1,226 | Thanks for reporting! oof, that must have been annoying to find.
I think the solution for this is that `Line` or `Span` should probably strip all null characters?
This is related to the recent unicode-width change in 0.1.13, which makes these characters now be measured as one character wide instead of 0 characters. Se... | [
"1211"
] | 0.27 | ratatui/ratatui | 2024-07-12T20:26:33Z | diff --git a/src/buffer/buffer.rs b/src/buffer/buffer.rs
--- a/src/buffer/buffer.rs
+++ b/src/buffer/buffer.rs
@@ -931,4 +932,35 @@ mod tests {
buf.set_string(0, 1, "bar", Style::new().blue());
assert_eq!(buf, Buffer::with_lines(["foo".red(), "bar".blue()]));
}
+
+ #[test]
+ fn control_sequ... | Visual glitch - Null character inside block wrapped component alters borders
## Description
G'day,
This one took me a while to investigate in a project so thought I'd report here in case it helps someone else.
When a block wrapped widget contains text with a null character (eg `\0`), and is styled (e.g colour or b... | 935a7187c273e0efc876d094d6247d50e28677a3 | [
"buffer::buffer::tests::control_sequence_rendered_partially",
"buffer::buffer::tests::control_sequence_rendered_full"
] | [
"backend::crossterm::tests::from_crossterm_color",
"backend::crossterm::tests::from_crossterm_content_style_underline",
"backend::crossterm::tests::from_crossterm_content_style",
"backend::crossterm::tests::modifier::from_crossterm_attribute",
"backend::crossterm::tests::modifier::from_crossterm_attributes"... | [
"backend::test::tests::buffer_view_with_overwrites"
] | [] |
c5ea656385843c880b3bef45dccbe8ea57431d10 | diff --git a/src/widgets/barchart.rs b/src/widgets/barchart.rs
--- a/src/widgets/barchart.rs
+++ b/src/widgets/barchart.rs
@@ -335,6 +335,26 @@ impl<'a> BarChart<'a> {
}
fn render_horizontal_bars(self, buf: &mut Buffer, bars_area: Rect, max: u64) {
+ // get the longest label
+ let label_size =... | ratatui__ratatui-518 | 518 | I can work on that.
I'm wondering how should we handle something like this.
```rust
let data = vec![
("January", 10),
("February", 20),
("March", 30),
("April", 40),
("May", 50),
("June", 60),
];
```
Bars should always be aligned so we have to have a max label length somehow.
... | [
"499"
] | 0.23 | ratatui/ratatui | 2023-09-19T23:43:13Z | diff --git a/src/widgets/barchart.rs b/src/widgets/barchart.rs
--- a/src/widgets/barchart.rs
+++ b/src/widgets/barchart.rs
@@ -1093,6 +1119,21 @@ mod tests {
test_horizontal_bars_label_width_greater_than_bar(Some(Color::White))
}
+ /// Tests horizontal bars label are presents
+ #[test]
+ fn tes... | Horizontal Barchart does not print labels
## Description
Horizontal Barcharts were added recently (0.23.0), but labels were not implemented.
Barcharts have two label types: label and text_value (a formatted version of the value), only the latter is rendered.
## To Reproduce
```rust
let data = vec![
("Jan", ... | 3bda37284781b62560cde2a7fa774211f651ec25 | [
"widgets::barchart::tests::test_horizontal_label"
] | [
"backend::test::tests::assert_buffer_panics - should panic",
"backend::test::tests::assert_buffer",
"backend::test::tests::resize",
"backend::test::tests::get_cursor",
"backend::test::tests::test_buffer_view",
"backend::test::tests::draw",
"backend::tests::clear_type_from_str",
"backend::tests::clear_... | [
"backend::test::tests::buffer_view_with_overwrites",
"buffer::tests::buffer_set_string_zero_width",
"widgets::paragraph::test::zero_width_char_at_end_of_line",
"widgets::reflow::test::line_composer_zero_width_at_end"
] | [] |
446efae185a5bb02a9ab6481542d1dc3024b66a9 | diff --git a/src/title.rs b/src/title.rs
--- a/src/title.rs
+++ b/src/title.rs
@@ -50,8 +50,8 @@ impl<'a> Default for Title<'a> {
fn default() -> Self {
Self {
content: Line::from(""),
- alignment: Some(Alignment::Left),
- position: Some(Position::Top),
+ alig... | ratatui__ratatui-323 | 323 | [
"322"
] | 0.21 | ratatui/ratatui | 2023-07-16T23:26:44Z | diff --git a/src/widgets/block.rs b/src/widgets/block.rs
--- a/src/widgets/block.rs
+++ b/src/widgets/block.rs
@@ -515,6 +515,7 @@ impl<'a> Styled for Block<'a> {
mod tests {
use super::*;
use crate::{
+ assert_buffer_eq,
layout::Rect,
style::{Color, Modifier, Stylize},
};
diff ... | `title_alignment` does not work as expected
## Description
`title_alignment` does not have effect on `Block` title when used without `Title`.
## To Reproduce
```rs
fn ui<B: Backend>(f: &mut Frame<B>) {
let size = f.size();
let block = Block::default()
.borders(Borders::ALL)
.titl... | 446efae185a5bb02a9ab6481542d1dc3024b66a9 | [
"widgets::block::tests::title_alignment",
"widgets_block_title_alignment"
] | [
"buffer::tests::buffer_merge3",
"buffer::tests::buffer_merge2",
"buffer::tests::buffer_diffing_multi_width_offset",
"buffer::tests::buffer_set_string",
"buffer::tests::buffer_set_string_double_width",
"buffer::tests::buffer_set_string_multi_width_overwrite",
"buffer::tests::buffer_diffing_multi_width",
... | [
"buffer::tests::buffer_set_string_zero_width",
"widgets::paragraph::test::zero_width_char_at_end_of_line",
"widgets::reflow::test::line_composer_zero_width_at_end",
"src/backend/termwiz.rs - backend::termwiz::TermwizBackend (line 27)"
] | [] | |
2889c7d08448a5bd786329fdaeedbb37f77d55b9 | diff --git a/src/backend/crossterm.rs b/src/backend/crossterm.rs
--- a/src/backend/crossterm.rs
+++ b/src/backend/crossterm.rs
@@ -12,7 +12,7 @@ use crossterm::{
execute, queue,
style::{
Attribute as CAttribute, Color as CColor, Print, SetAttribute, SetBackgroundColor,
- SetForegroundColor,
+ ... | ratatui__ratatui-310 | 310 | Sounds like a nice feature, feel free to submit a PR! 🐻
I've noticed only crossterm supports setting the underline color, termion and termwiz do not.
Is putting it behind the crossterm feature flag the option you prefer?
The proposed function name will conflict with https://github.com/tui-rs-revival/ratatui/pull/289... | [
"308"
] | 0.21 | ratatui/ratatui | 2023-07-14T08:22:00Z | diff --git a/src/buffer.rs b/src/buffer.rs
--- a/src/buffer.rs
+++ b/src/buffer.rs
@@ -607,6 +648,25 @@ mod tests {
.bg(Color::Yellow)
.add_modifier(Modifier::BOLD),
);
+ #[cfg(feature = "crossterm")]
+ assert_eq!(
+ format!("{buf:?}"),
+ in... | Enable setting the underline color
## Problem
There is a nonstandard ansi escape code that allows setting the underline color.
This is done with the code `58`. it uses the same arguments as the `38` and `48` codes do for settings their colors.
The underline color can be reset with the code `59`.
See [kitty docu... | 446efae185a5bb02a9ab6481542d1dc3024b66a9 | [
"buffer::tests::it_implements_debug"
] | [
"buffer::tests::buffer_diffing_empty_empty",
"buffer::tests::buffer_diffing_empty_filled",
"buffer::tests::buffer_diffing_multi_width_offset",
"buffer::tests::buffer_merge",
"buffer::tests::buffer_set_string",
"buffer::tests::buffer_with_lines",
"buffer::tests::it_translates_to_and_from_coordinates",
... | [
"buffer::tests::buffer_set_string_zero_width",
"widgets::paragraph::test::zero_width_char_at_end_of_line",
"widgets::reflow::test::line_composer_zero_width_at_end",
"src/backend/termwiz.rs - backend::termwiz::TermwizBackend (line 27)"
] | [] |
d2d91f754c87458c6d07863eca20f3ea8ae319ce | diff --git a/src/widgets/scrollbar.rs b/src/widgets/scrollbar.rs
--- a/src/widgets/scrollbar.rs
+++ b/src/widgets/scrollbar.rs
@@ -454,7 +454,7 @@ impl<'a> StatefulWidget for Scrollbar<'a> {
let area = self.scollbar_area(area);
for x in area.left()..area.right() {
for y in area.top()..are... | ratatui__ratatui-911 | 911 | [
"910"
] | 0.26 | ratatui/ratatui | 2024-02-03T18:02:50Z | diff --git a/src/widgets/scrollbar.rs b/src/widgets/scrollbar.rs
--- a/src/widgets/scrollbar.rs
+++ b/src/widgets/scrollbar.rs
@@ -769,6 +769,83 @@ mod tests {
);
}
+ #[rstest]
+ #[case("█████ ", 0, 10, "position_0")]
+ #[case(" █████ ", 1, 10, "position_1")]
+ #[case(" █████ ", 2,... | Scrollbar with `.track_symbol(None)` renders incorrectly
## Description
https://github.com/ratatui-org/ratatui/assets/1813121/03646e25-aa2a-41de-ba0b-d0397862de3a
Using code like this causes the problem:
```rust
f.render_stateful_widget(Scrollbar::default().begin_symbol(None).end_symbol(None), area, &mut ... | 943c0431d968a82b23a2f31527f32e57f86f8a7c | [
"widgets::scrollbar::tests::render_scrollbar_without_track_symbols::case_04",
"widgets::scrollbar::tests::render_scrollbar_without_track_symbols::case_03",
"widgets::scrollbar::tests::render_scrollbar_without_track_symbols::case_05",
"widgets::scrollbar::tests::render_scrollbar_without_track_symbols::case_02"... | [
"backend::crossterm::tests::from_crossterm_color",
"backend::termwiz::tests::into_color::from_ansicolor",
"backend::crossterm::tests::modifier::from_crossterm_attributes",
"backend::termion::tests::from_termion_bg",
"backend::crossterm::tests::from_crossterm_content_style",
"backend::termwiz::tests::into_... | [
"backend::test::tests::buffer_view_with_overwrites",
"buffer::buffer::tests::set_string_zero_width",
"widgets::paragraph::test::zero_width_char_at_end_of_line",
"widgets::reflow::test::line_composer_zero_width_at_end"
] | [] | |
1d86009a18c62600f811b8596f585f2e02f5f1dc | diff --git a/src/de/mod.rs b/src/de/mod.rs
--- a/src/de/mod.rs
+++ b/src/de/mod.rs
@@ -122,7 +122,7 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
b'[' => self.deserialize_seq(visitor),
b'{' => self.deserialize_map(visitor),
b'0'...b'9' | b'+' | b'-' | b'.'... | ron-rs__ron-114 | 114 | [
"113"
] | 0.2 | ron-rs/ron | 2018-06-06T22:32:54Z | diff --git /dev/null b/tests/value.rs
new file mode 100644
--- /dev/null
+++ b/tests/value.rs
@@ -0,0 +1,65 @@
+extern crate ron;
+
+use std::collections::BTreeMap;
+
+use ron::value::{Number, Value};
+
+#[test]
+fn bool() {
+ assert_eq!(Value::from_str("true"), Ok(Value::Bool(true)));
+ assert_eq!(Value::from_st... | Forgot to hook up raw string literals with deserialize_any
I made a mistake in #112 where I forgot to update [the appropriate branch](https://github.com/ron-rs/ron/blob/master/src/de/mod.rs#L125) in `de/mod.rs` to work with raw string literals. The match pattern should be `b'"' | b'r'` in order for raw string literal d... | 1d86009a18c62600f811b8596f585f2e02f5f1dc | [
"string"
] | [
"de::tests::expected_attribute",
"de::tests::expected_attribute_end",
"de::tests::forgot_apostrophes",
"de::tests::implicit_some",
"de::tests::invalid_attribute",
"de::tests::multiple_attributes",
"de::tests::test_array",
"de::tests::test_char",
"de::tests::test_comment",
"de::tests::test_empty_st... | [
"test_nul_in_string"
] | [] | |
82cc3a2015f3c5f0de328ce0fb6629d807f3cd47 | diff --git a/src/parse.rs b/src/parse.rs
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -342,11 +342,17 @@ impl<'a> Bytes<'a> {
}
pub fn string(&mut self) -> Result<ParsedStr> {
- use std::iter::repeat;
-
- if !self.consume("\"") {
- return self.err(ParseError::ExpectedString);
+ i... | ron-rs__ron-112 | 112 | Sounds like a useful feature to me @ebkalderon! Do you want to work on this?
@torkleyy Sure! I can try. | [
"111"
] | 0.2 | ron-rs/ron | 2018-06-06T00:06:05Z | diff --git a/src/de/tests.rs b/src/de/tests.rs
--- a/src/de/tests.rs
+++ b/src/de/tests.rs
@@ -93,8 +93,19 @@ fn test_map() {
#[test]
fn test_string() {
let s: String = from_str("\"String\"").unwrap();
-
assert_eq!("String", s);
+
+ let raw: String = from_str("r\"String\"").unwrap();
+ assert_eq!("Str... | Support for multi-line string literals
Will RON ever support multi-line string literals? This is a feature that missing from JSON, but is present in YAML, TOML, and in Rust proper, like so:
```yaml
# YAML multi-line string literals
key: >
This is a very long sentence
that spans several lines in the YAML
b... | 1d86009a18c62600f811b8596f585f2e02f5f1dc | [
"de::tests::test_string"
] | [
"de::tests::expected_attribute",
"de::tests::expected_attribute_end",
"de::tests::forgot_apostrophes",
"de::tests::invalid_attribute",
"de::tests::multiple_attributes",
"de::tests::implicit_some",
"de::tests::test_array",
"de::tests::test_char",
"de::tests::test_comment",
"de::tests::test_enum",
... | [
"test_nul_in_string"
] | [] |
5efdf123de373ec466b3dbfd0c61a4f6991a0127 | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ron"
-version = "0.2.1"
+version = "0.2.2"
license = "MIT/Apache-2.0"
keywords = ["parser", "serde", "serialization"]
authors = [
diff --git a/src/de/mod.rs b/src/de/mod.rs
--- a/src/de/mod.rs
+++ b/src/de/mod.... | ron-rs__ron-108 | 108 | Was this fixed in https://github.com/ron-rs/ron/commit/239cb7919ff06abdf2bd40514b16f39d6c3786f4?
Possibly, at least there was a similar bug.
Or in https://github.com/ron-rs/ron/commit/713284f17ab1b0883f0206c50e08d2c88b80e061 | [
"107"
] | 0.2 | ron-rs/ron | 2018-05-20T12:41:47Z | diff --git a/src/de/tests.rs b/src/de/tests.rs
--- a/src/de/tests.rs
+++ b/src/de/tests.rs
@@ -258,3 +258,8 @@ fn implicit_some() {
// Not concise
assert_eq!(de::<Option<Option<char>>>("None"), None);
}
+
+#[test]
+fn ws_tuple_newtype_variant() {
+ assert_eq!(Ok(MyEnum::B(true)), from_str("B ( \n true \n... | `to_string` produces text that `from_str` does not accept (with tuple variants)
```
# Cargo.toml
ron = "0.2.1"
```
---
Given the following type:
```rust
pub enum FileOrMem {
File(String),
Memory,
}
```
`ser::to_string` produces the following RON:
```
data: Node (
... | 1d86009a18c62600f811b8596f585f2e02f5f1dc | [
"de::tests::ws_tuple_newtype_variant"
] | [
"de::tests::expected_attribute",
"de::tests::expected_attribute_end",
"de::tests::forgot_apostrophes",
"de::tests::invalid_attribute",
"de::tests::implicit_some",
"de::tests::multiple_attributes",
"de::tests::test_array",
"de::tests::test_char",
"de::tests::test_empty_struct",
"de::tests::test_com... | [
"test_nul_in_string"
] | [] |
a5a4b2ee21f5be0b07c55844e2689ae8a521da3b | diff --git a/src/de/mod.rs b/src/de/mod.rs
--- a/src/de/mod.rs
+++ b/src/de/mod.rs
@@ -313,6 +313,7 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
self.bytes.skip_ws()?;
if self.bytes.consume("(") {
+ self.bytes.skip_ws()?;
let value = visitor.visit_ne... | ron-rs__ron-103 | 103 | [
"102"
] | 0.2 | ron-rs/ron | 2018-04-26T19:22:39Z | diff --git a/tests/big_struct.rs b/tests/big_struct.rs
--- a/tests/big_struct.rs
+++ b/tests/big_struct.rs
@@ -39,8 +39,12 @@ pub struct ImGuiStyleSave {
pub anti_aliased_shapes: bool,
pub curve_tessellation_tol: f32,
pub colors: ImColorsSave,
+ pub new_type: NewType,
}
+#[derive(Serialize, Deseria... | Parser doesn't handle whitespace ...
between `(` and `[` of a `newtype_struct` wrapping a `seq`:
```rust
#[derive(Debug, Deserialize)]
struct Newtype(Vec<String>);
fn main() {
let serialized = stringify!(
Newtype([
"a",
"b",
"c",
])
);
pr... | 1d86009a18c62600f811b8596f585f2e02f5f1dc | [
"deserialize_big_struct"
] | [
"de::tests::forgot_apostrophes",
"de::tests::expected_attribute_end",
"de::tests::expected_attribute",
"de::tests::invalid_attribute",
"de::tests::multiple_attributes",
"de::tests::implicit_some",
"de::tests::test_array",
"de::tests::test_char",
"de::tests::test_empty_struct",
"de::tests::test_com... | [
"test_nul_in_string"
] | [] | |
83f67a083bb22c000164052d80b9a559084f3f80 | diff --git a/src/parse.rs b/src/parse.rs
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -81,29 +81,52 @@ impl<'a> Bytes<'a> {
}
pub fn char(&mut self) -> Result<char> {
+ use std::cmp::min;
+
if !self.consume("'") {
return self.err(ParseError::ExpectedChar);
}
- let ... | ron-rs__ron-80 | 80 | [
"49"
] | 0.2 | ron-rs/ron | 2018-01-20T21:46:43Z | diff --git /dev/null b/tests/unicode.rs
new file mode 100644
--- /dev/null
+++ b/tests/unicode.rs
@@ -0,0 +1,15 @@
+extern crate ron;
+
+use ron::de::from_str;
+
+#[test]
+fn test_char() {
+ let de: char = from_str("'Փ'").unwrap();
+ assert_eq!(de, 'Փ');
+}
+
+#[test]
+fn test_string() {
+ let de: String = fro... | Properly handle unicode
I'm pretty sure unicode support isn't fully implemented, so we would need tests and full support in serializer and deserializer. Additionally, rules should go into the spec (probably in a text document in this repository, as suggested somewhere).
| 1d86009a18c62600f811b8596f585f2e02f5f1dc | [
"test_char"
] | [
"de::tests::expected_attribute",
"de::tests::expected_attribute_end",
"de::tests::forgot_apostrophes",
"de::tests::multiple_attributes",
"de::tests::invalid_attribute",
"de::tests::implicit_some",
"de::tests::test_array",
"de::tests::test_char",
"de::tests::test_comment",
"de::tests::test_empty_st... | [] | [] | |
1ff0efa8c87590b14af8a9d61e1fa7288c7455f1 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -40,6 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix serialising reserved identifiers `true`, `false`, `Some`, `None`, `inf`[`f32`|`f64`], and `Nan`[`f32`|`f64`] ([#487](https://github.com... | ron-rs__ron-512 | 512 | Thank you @grindvoll for reporting and investigating this issue! This sounds like an easy-enough change to me. Would you like to file a PR yourself that also adds a test with your usecase? I'm unfortunately quite swamped with uni at the moment.
Ok, I will try to file a PR with unit test as soon as possible. | [
"511"
] | 0.9 | ron-rs/ron | 2023-10-02T22:33:22Z | diff --git /dev/null b/tests/511_deserialize_any_map_string_key.rs
new file mode 100644
--- /dev/null
+++ b/tests/511_deserialize_any_map_string_key.rs
@@ -0,0 +1,76 @@
+#[test]
+fn test_map_custom_deserialize() {
+ use std::collections::HashMap;
+
+ #[derive(PartialEq, Debug)]
+ struct CustomMap(HashMap<Strin... | Problem deserializing maps when deserialization target expect owned String keys
I just encountered this somewhat strange behavior. Trying to deserialize a very simple RON string into a `serde_json::Value` fails with an `ExpectedIdentifier` error:
```rust
let json: serde_json::Value = ron::from_str("(f1: 0, f2: ... | d3e9ebee2cb9dd7e1ed1ae3d6ed4bea6e05a139d | [
"test_map_custom_deserialize",
"test_ron_struct_as_json_map"
] | [
"de::tests::expected_attribute",
"de::tests::expected_attribute_end",
"de::tests::boolean_struct_name",
"de::tests::forgot_apostrophes",
"de::tests::invalid_attribute",
"de::tests::implicit_some",
"de::tests::multiple_attributes",
"de::tests::rename",
"de::tests::test_char",
"de::tests::test_comme... | [] | [] |
cb8bd4d32727c6aadeaea561910d45d7df0a0673 | diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ron"
-version = "0.1.5"
+version = "0.2.0"
license = "MIT/Apache-2.0"
keywords = ["parser", "serde", "serialization"]
authors = [
diff --git a/docs/grammar.md b/docs/grammar.md
--- a/docs/grammar.md
+++ b/docs/... | ron-rs__ron-78 | 78 | Yep, @kvark mentioned this in a recent PR.
We happen to need this for gfx-warden as well. Even though, native support for `bitflags` would have been even better. Man can dream...
So I assume we use `0x` for hexadecimal and `0b` for binary? | [
"76"
] | 0.1 | ron-rs/ron | 2018-01-19T23:37:44Z | diff --git /dev/null b/tests/numbers.rs
new file mode 100644
--- /dev/null
+++ b/tests/numbers.rs
@@ -0,0 +1,22 @@
+extern crate ron;
+
+#[test]
+fn test_hex() {
+ assert_eq!(ron::de::from_str("0x507"), Ok(0x507));
+ assert_eq!(ron::de::from_str("0x1A5"), Ok(0x1A5));
+ assert_eq!(ron::de::from_str("0x53C537"),... | Add hexadecimal numbers
And maybe it's a good idea to add octal and binary (`0o...` and `0b...`) notations too.
| cb8bd4d32727c6aadeaea561910d45d7df0a0673 | [
"test_bin",
"test_hex",
"test_oct"
] | [
"de::tests::expected_attribute",
"de::tests::expected_attribute_end",
"de::tests::forgot_apostrophes",
"de::tests::invalid_attribute",
"de::tests::implicit_some",
"de::tests::multiple_attributes",
"de::tests::test_char",
"de::tests::test_array",
"de::tests::test_comment",
"de::tests::test_empty_st... | [] | [] |
78c7aae1306a8df5c70ad4d30ecfaaf13bacd11c | diff --git a/src/de/mod.rs b/src/de/mod.rs
--- a/src/de/mod.rs
+++ b/src/de/mod.rs
@@ -228,23 +228,28 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
fn deserialize_option<V>(self, visitor: V) -> Result<V::Value>
where V: Visitor<'de>
{
- if self.bytes.consume("Some") &&... | ron-rs__ron-75 | 75 | @ozkriff If you don't specify a font, you'll use some fallback, right?
Correct.
```rust
#[derive(Deserialize)]
struct Settings {
#[serde(default = "default_font")]
font: String,
}
fn default_font() -> String {
"default.ttf".to_owned()
}
```
The problem in this specific case is that if there's no ... | [
"55"
] | 0.1 | ron-rs/ron | 2018-01-18T02:33:21Z | diff --git a/src/de/tests.rs b/src/de/tests.rs
--- a/src/de/tests.rs
+++ b/src/de/tests.rs
@@ -209,3 +209,28 @@ fn uglified_attribute() {
assert_eq!(de, Ok(()));
}
+
+#[test]
+fn implicit_some() {
+ use serde::de::DeserializeOwned;
+
+ fn de<T: DeserializeOwned>(s: &str) -> Option<T> {
+ let enable... | Ergonomics of optional fields
If I have a struct like
```rust
#[derive(Debug, Clone, Deserialize)]
pub struct Settings {
pub font: Option<PathBuf>, // <- optional field
pub other_value: u8,
}
```
I can omit the field in `.ron` file to get `None`:
```json
(
other_value: 0,
)
```
But I'm... | cb8bd4d32727c6aadeaea561910d45d7df0a0673 | [
"de::tests::implicit_some",
"implicit_some"
] | [
"de::tests::expected_attribute",
"de::tests::forgot_apostrophes",
"de::tests::expected_attribute_end",
"de::tests::invalid_attribute",
"de::tests::multiple_attributes",
"de::tests::test_char",
"de::tests::test_array",
"de::tests::test_empty_struct",
"de::tests::test_comment",
"de::tests::test_enum... | [] | [] |
ecdcd83b79ce9124fbf6ea1ce0611e896ec7bbe6 | diff --git a/src/de/mod.rs b/src/de/mod.rs
--- a/src/de/mod.rs
+++ b/src/de/mod.rs
@@ -5,10 +5,11 @@ pub use crate::parse::Position;
use serde::de::{self, DeserializeSeed, Deserializer as SerdeError, Visitor};
use std::{borrow::Cow, io, str};
-use self::id::IdDeserializer;
-use self::tag::TagDeserializer;
-use crat... | ron-rs__ron-206 | 206 | [
"202"
] | 0.5 | ron-rs/ron | 2020-03-28T07:55:23Z | diff --git a/src/ser/mod.rs b/src/ser/mod.rs
--- a/src/ser/mod.rs
+++ b/src/ser/mod.rs
@@ -800,7 +952,7 @@ mod tests {
fn test_struct() {
let my_struct = MyStruct { x: 4.0, y: 7.0 };
- assert_eq!(to_string(&my_struct).unwrap(), "(x:4,y:7,)");
+ assert_eq!(to_string(&my_struct).unwrap(), "(... | Add function to serialize to a Writer
Bincode has [`serialize_into`](https://docs.rs/bincode/1.2.1/bincode/fn.serialize_into.html) which supports an arbitrary Writer, this would be very useful for RON as well, especially with `BufWriter`, because the data gets very large.
I'm seeing huge RAM spikes because of RON se... | c6873c6f8a953c5532174baa02937b00558996f5 | [
"ser::tests::test_array",
"ser::tests::test_byte_stream",
"ser::tests::test_enum",
"ser::tests::test_struct",
"test_vessd_case",
"test_externally_a_ser",
"test_externally_b_ser",
"test_internally_a_ser",
"test_internally_b_ser",
"test_untagged_a_ser",
"test_untagged_b_ser",
"depth_limit"
] | [
"de::tests::expected_attribute",
"de::tests::forgot_apostrophes",
"de::tests::expected_attribute_end",
"de::tests::invalid_attribute",
"de::tests::multiple_attributes",
"de::tests::implicit_some",
"de::tests::test_array",
"de::tests::test_any_number_precision",
"de::tests::test_byte_stream",
"de::... | [
"test_adjacently_a_de",
"test_adjacently_a_ser",
"test_adjacently_b_de",
"test_adjacently_b_ser",
"test_nul_in_string"
] | [] | |
64ba4a541204defb8218e75b7bea7c3a7c771226 | diff --git a/src/ser/mod.rs b/src/ser/mod.rs
--- a/src/ser/mod.rs
+++ b/src/ser/mod.rs
@@ -18,6 +18,7 @@ where
output: String::new(),
pretty: None,
struct_names: false,
+ is_empty: None,
};
value.serialize(&mut s)?;
Ok(s.output)
diff --git a/src/ser/mod.rs b/src/ser/mod.... | ron-rs__ron-150 | 150 | [
"147"
] | 0.4 | ron-rs/ron | 2019-03-05T17:08:59Z | diff --git /dev/null b/tests/147_empty_sets_serialisation.rs
new file mode 100644
--- /dev/null
+++ b/tests/147_empty_sets_serialisation.rs
@@ -0,0 +1,73 @@
+use serde::{Deserialize, Serialize};
+use std::collections::HashMap;
+
+#[derive(Debug, PartialEq, Deserialize, Serialize)]
+struct UnitStruct;
+
+#[derive(Debug,... | Don't split empty sets/arrays into multiple lines
I noticed a lot of sections like this:
```ron
vertical_blurs: [
],
horizontal_blurs: [
],
scalings: [
... | 697de994d642adf0f856d1a4d4e99b0e288367b2 | [
"empty_sets_arrays"
] | [
"de::tests::expected_attribute",
"de::tests::expected_attribute_end",
"de::tests::forgot_apostrophes",
"de::tests::invalid_attribute",
"de::tests::implicit_some",
"de::tests::multiple_attributes",
"de::tests::test_array",
"de::tests::test_byte_stream",
"de::tests::test_comment",
"de::tests::test_c... | [
"test_nul_in_string"
] | [] | |
c6873c6f8a953c5532174baa02937b00558996f5 | diff --git a/src/ser/mod.rs b/src/ser/mod.rs
--- a/src/ser/mod.rs
+++ b/src/ser/mod.rs
@@ -224,7 +224,7 @@ impl Serializer {
fn is_pretty(&self) -> bool {
match self.pretty {
- Some((ref config, ref pretty)) => pretty.indent < config.depth_limit,
+ Some((ref config, ref pretty)) =>... | ron-rs__ron-225 | 225 | yeah, let's fix this
Bump :)
PR's welcome!
yeah, let's fix this
Bump :)
PR's welcome! | [
"174",
"174"
] | 0.5 | ron-rs/ron | 2020-05-03T07:28:48Z | diff --git a/tests/depth_limit.rs b/tests/depth_limit.rs
--- a/tests/depth_limit.rs
+++ b/tests/depth_limit.rs
@@ -49,7 +49,7 @@ fn depth_limit() {
};
let pretty = ron::ser::PrettyConfig::new()
- .with_depth_limit(2)
+ .with_depth_limit(1)
.with_separate_tuple_members(true)
.... | Depth limit seems to be off by one
Currently, a depth limit of `1` means that nothing gets indented (same for `0`). That seems wrong, as the limit should be the (inclusive) maximum depth.
This can be fixed by changing the `pretty.indent < config.ident` to a `<=` check.
@kvark Do you agree this is a bug?
Depth lim... | c6873c6f8a953c5532174baa02937b00558996f5 | [
"depth_limit"
] | [
"de::tests::expected_attribute",
"de::tests::expected_attribute_end",
"de::tests::forgot_apostrophes",
"de::tests::invalid_attribute",
"de::tests::implicit_some",
"de::tests::multiple_attributes",
"de::tests::test_any_number_precision",
"de::tests::test_char",
"de::tests::test_array",
"de::tests::... | [
"test_adjacently_a_de",
"test_adjacently_a_ser",
"test_adjacently_b_de",
"test_adjacently_b_ser",
"test_nul_in_string"
] | [] |
4993b34e5bc3da8d5977acbf3d89b7032a45ead9 | diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/... | ron-rs__ron-324 | 324 | [
"322"
] | 0.6 | ron-rs/ron | 2021-10-22T15:39:40Z | diff --git /dev/null b/tests/322_escape_idents.rs
new file mode 100644
--- /dev/null
+++ b/tests/322_escape_idents.rs
@@ -0,0 +1,35 @@
+use serde::{Deserialize, Serialize};
+use std::collections::HashMap;
+
+#[derive(Debug, Deserialize, PartialEq, Serialize)]
+#[serde(rename_all = "kebab-case")]
+enum MyEnumWithDashes ... | Identifiers get serialized without raw ident escape
Minimal example:
```rust
#[derive(Debug, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "kebab-case")]
struct MyStructWithDash {
will_be_renamed: u32,
}
#[test]
fn roundtrip_ident_with_dash() {
let value = MyStructWithDash {
wil... | 4993b34e5bc3da8d5977acbf3d89b7032a45ead9 | [
"roundtrip_ident_with_dash"
] | [
"de::tests::expected_attribute",
"de::tests::expected_attribute_end",
"de::tests::forgot_apostrophes",
"de::tests::invalid_attribute",
"de::tests::implicit_some",
"de::tests::multiple_attributes",
"de::tests::rename",
"de::tests::test_any_number_precision",
"de::tests::test_array",
"de::tests::tes... | [
"test_adjacently_a_de",
"test_adjacently_a_ser",
"test_adjacently_b_de",
"test_adjacently_b_ser",
"test_nul_in_string"
] | [] | |
b3284a42fb0d175da1a822bda73bd300ddab72c3 | diff --git a/spinoso-time/src/time/tzrs/parts.rs b/spinoso-time/src/time/tzrs/parts.rs
--- a/spinoso-time/src/time/tzrs/parts.rs
+++ b/spinoso-time/src/time/tzrs/parts.rs
@@ -316,7 +316,7 @@ impl Time {
self.inner.local_time_type().is_dst()
}
- /// Returns an integer representing the day of the week,... | artichoke__artichoke-2073 | 2,073 | [
"2072"
] | 1.62 | artichoke/artichoke | 2022-08-11T23:52:40Z | diff --git a/spinoso-time/src/time/tzrs/parts.rs b/spinoso-time/src/time/tzrs/parts.rs
--- a/spinoso-time/src/time/tzrs/parts.rs
+++ b/spinoso-time/src/time/tzrs/parts.rs
@@ -550,4 +550,29 @@ mod tests {
assert_eq!("UTC", dt.time_zone());
assert!(dt.is_utc());
}
+
+ #[test]
+ fn yday() {
+ ... | The doc of `spinoso_time::tzrs::Time::day_of_year()` is inconsistent with its implementation
The doc of `spinoso_time::tzrs::Time::day_of_year()` is inconsistent with its implementation:
https://github.com/artichoke/artichoke/blob/b3284a42fb0d175da1a822bda73bd300ddab72c3/spinoso-time/src/time/tzrs/parts.rs#L511-L533.
... | b3284a42fb0d175da1a822bda73bd300ddab72c3 | [
"time::tzrs::parts::tests::yday"
] | [
"time::chrono::build::tests::time_at_with_max_i64_overflow",
"time::chrono::build::tests::time_at_with_min_i64_overflow",
"time::chrono::build::tests::time_at_with_overflowing_negative_sub_second_nanos",
"time::chrono::build::tests::time_at_with_negative_sub_second_nanos",
"time::chrono::build::tests::time_... | [] | [] | |
dc140a55012ab4fd671fc4974f3aed7b0de23c7a | diff --git a/src/dynamic/resolve.rs b/src/dynamic/resolve.rs
--- a/src/dynamic/resolve.rs
+++ b/src/dynamic/resolve.rs
@@ -336,7 +336,13 @@ fn collect_fields<'a>(
type_condition.map(|condition| condition.node.on.node.as_str());
let introspection_type_name = &object.name;
- ... | async-graphql__async-graphql-1228 | 1,228 | [
"1223"
] | 5.0 | async-graphql/async-graphql | 2023-02-07T17:56:55Z | diff --git a/src/dynamic/interface.rs b/src/dynamic/interface.rs
--- a/src/dynamic/interface.rs
+++ b/src/dynamic/interface.rs
@@ -389,4 +389,47 @@ mod tests {
}]
);
}
+ #[tokio::test]
+ async fn query_type_condition() {
+ struct MyObjA;
+ let obj_a = Object::new("MyObjA")... | dynamic schema: query interface on union not working
## Expected Behavior
when we have a union of objects that some of which implements an interface, we should be able to query the union by the interface. In the following example, if the `pet` is queried by the `Named` interface, we expect the `name` field and `__ty... | dc140a55012ab4fd671fc4974f3aed7b0de23c7a | [
"dynamic::union::tests::test_query",
"dynamic::interface::tests::query_type_condition"
] | [
"dataloader::tests::test_dataloader",
"dynamic::interface::tests::basic_interface",
"dataloader::tests::test_duplicate_keys",
"dataloader::tests::test_dataloader_disable_all_cache",
"dynamic::input_object::tests::oneof_input_object",
"dynamic::scalar::tests::custom_scalar",
"dynamic::input_object::tests... | [] | [] | |
faa78d071cfae795dacc39fd46900fdfb6157d0d | diff --git a/src/registry/export_sdl.rs b/src/registry/export_sdl.rs
--- a/src/registry/export_sdl.rs
+++ b/src/registry/export_sdl.rs
@@ -259,10 +259,8 @@ impl Registry {
write!(sdl, " @tag(name: \"{}\")", tag.replace('"', "\\\"")).ok();
}
}
- ... | async-graphql__async-graphql-1559 | 1,559 | [
"1558"
] | 7.0 | async-graphql/async-graphql | 2024-07-09T18:56:37Z | diff --git a/tests/schemas/test_fed2_compose_2.schema.graphql b/tests/schemas/test_fed2_compose_2.schema.graphql
--- a/tests/schemas/test_fed2_compose_2.schema.graphql
+++ b/tests/schemas/test_fed2_compose_2.schema.graphql
@@ -3,7 +3,7 @@
type Query {
- testArgument(arg: String! @type_directive_argument_definition... | The custom directive ARGUMENT_DEFINITION is not being output at the appropriate location in SDL
## Rust Code
```rust
use async_graphql::*;
#[TypeDirective(location = "ArgumentDefinition")]
fn testDirective(desc: String) {}
struct Query;
#[Object]
impl Query {
async fn add(
&self,
#... | faa78d071cfae795dacc39fd46900fdfb6157d0d | [
"test_type_directive_2"
] | [
"dataloader::tests::test_dataloader_load_empty",
"dynamic::check::tests::test_recursive_input_objects_local_cycle",
"dynamic::check::tests::test_recursive_input_objects",
"dynamic::check::tests::test_recursive_input_objects_bad",
"dataloader::tests::test_dataloader_disable_all_cache",
"dataloader::tests::... | [] | [] | |
faa78d071cfae795dacc39fd46900fdfb6157d0d | diff --git a/src/types/external/bson.rs b/src/types/external/bson.rs
--- a/src/types/external/bson.rs
+++ b/src/types/external/bson.rs
@@ -11,6 +11,13 @@ impl ScalarType for ObjectId {
fn parse(value: Value) -> InputValueResult<Self> {
match value {
Value::String(s) => Ok(ObjectId::parse_str(... | async-graphql__async-graphql-1542 | 1,542 | [
"1541",
"1541"
] | 7.0 | async-graphql/async-graphql | 2024-06-16T20:13:02Z | diff --git a/src/types/external/bson.rs b/src/types/external/bson.rs
--- a/src/types/external/bson.rs
+++ b/src/types/external/bson.rs
@@ -69,3 +87,34 @@ impl ScalarType for Document {
bson::from_document(self.clone()).unwrap_or_default()
}
}
+
+#[cfg(test)]
+mod tests {
+ use serde_json::json;
+
+ ... | Support for extended JSON representations of BSON
## Description of the feature
BSON allows for a typed representation of its data in an [extended JSON representation](https://www.mongodb.com/docs/manual/reference/mongodb-extended-json/#mongodb-extended-json--v2-). To properly integrate with BSON, `async-graphql` shou... | faa78d071cfae795dacc39fd46900fdfb6157d0d | [
"types::external::bson::tests::test_parse_bson_object_id",
"types::external::bson::tests::test_parse_bson_uuid"
] | [
"dataloader::tests::test_dataloader_load_empty",
"dynamic::check::tests::test_recursive_input_objects_local_cycle",
"dynamic::check::tests::test_recursive_input_objects",
"dataloader::tests::test_dataloader_disable_cache",
"dynamic::interface::tests::basic_interface",
"dataloader::tests::test_dataloader_w... | [] | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.